Empty _site generated when using utf-8 characters
mmozuras opened this issue · 13 comments
Steps to reproduce:
1 Step one:
mkdir jekyll
cd jekyll
mkdir _layouts
2 Create index.html with this content:
---
layout: default
title: Test
---
<div></div>
3 Create _config.yml with this content:
markdown: rdiscount
auto: true
permalink: pretty
4 Create default.html in _layouts with this content:
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>{{ page.title }}</title>
</head>
<body>
<h1>Mindaugas Mozūras</h1>
</body>
</html>
5 Run:
jekyll --server
6 Observe that _site is completely empty.
7 Delete 'Mozūras' from default layout. Repeat step 5 and find that this time _site is not empty.
I'm using:
- MacVim/vim. Made sure it doesn't add any BOM characters.
- Ruby 1.9.2p290
- Jekyll 0.11.2
- RDiscount 1.6.8
I also added this to my ~/.profile:
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
GitHub Pages also failed to generate new version of my site when I added an utf-8 character.
What am I missing?
Thanks in advance for your help.
That is really weird. Are you sure that _site
does not contain index.html
and that this isn't a problem with your browser?
P.S. I noticed that you declared the character set twice. You only need to declare it once (<meta charset="utf-8" />
).
Yes, I'm sure. I encountered this issue on a slightly bigger site, this is just a repro example. At first I was jus surprised that my site is not updating with new content (jekyll doesn't delete old _site
by default). Then I looked at generated content and was surprised to find old content. I was even more surprised after deleting _site
and finding absolutely no content in _site
. I needed some time to find what was causing it, googling and (unsuccessfully) trying a couple of things. After that I came here and posted this issue.
P.S. Forgot to delete it from example (I didn't expect that to do anything, but I tried it anyway).
If you delete the content in _site
of course it wouldn't appear in there. The only thing I can think of at this point is to reinstall Jekyll.
What I meant - I delete _site
, run jekyll --server
, empty _site
gets created. I remove all utf-8 characters, delete _site
, run jekyll --server
, non-empty _site
gets created.
Also, I have the same result with GitHub Pages.
run with --no-auto
option you will see error message.
If message not clear try following: edit Gemfile
gem "jekyll", :git => "git://github.com/stereobooster/jekyll.git"
run
bundle install
bundle exec jekyll
Also check: there is no BOM
Here's the error message:
/Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:29:in `read_yaml': invalid byte sequence in US-ASCII (ArgumentError)
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/layout.rb:31:in `initialize'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `new'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `block in read_layouts'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:111:in `each'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:111:in `read_layouts'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:97:in `read'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in `process'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in `<top (required)>'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/bin/jekyll:19:in `load'
from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/bin/jekyll:19:in `<main>'
29th line in convertible.rb:
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
Again: check there is no BOM. Post your file.
No BOM. I understand why you're suggesting it - I tried setting BOM (:set bomb with Vim) and deleting utf-8 character ('ū'), I get exactly the same error.
One more idea. You set
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
Try locale which corresponds to this letter 'ū'
That was not it, but thanks to you I found what I missed. I'm using zsh, which doesn't load .profile
. I was not aware of that and until now I stupidly never bothered to run locale
to check if I actually change LANG/LC_ALL
.
Thanks and sorry for wasting everyone's valuable time.
It's okay. I still love you. :D
Just want to say that I had the exact same problem, and this thread was a big help. Thanks! :)
Thanks for this issue I could make jekyll work in my zsh!