问题
When I make a syntax error in the front matter i'm getting the following error:
/.../psych.rb:203:in `parse': (<unknown>): could not find expected
':' while scanning a simple key at line 6 column 1
(Psych::SyntaxError)
from /.../psych.rb:203:in `parse_stream'
from /.../psych.rb:151:in `parse'
from ....
Do you know a way to tell what file caused the problem?
I know that I could probably use DTrace as follows:
dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'| grep _posts
But I'm looking for something more straight forward.
回答1:
it seams that jekyll does not work well on ruby 1.9.3. A more restrictive yaml parser was introduced: Psych that probably has different exception hierarchy and there for it is not properly handled by jekyll.
回答2:
You may find that this is caused by faulty formatting
If your front matter looks like this:
---
menu:
- text: Home
url: /en/index.html
- text: Overview
url: /en/overview.html
---
instead of
---
menu:
- text: Home
url: /en/index.html
- text: Overview
url: /en/overview.html
---
then the YAML parser will throw it out.
来源:https://stackoverflow.com/questions/10417122/jekyll-with-broken-front-matter-how-to-find-the-broken-file