Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jekyll with broken front matter, how to find the broken file?

Tags:

github

jekyll

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.

like image 217
Piotr Czapla Avatar asked May 02 '12 15:05

Piotr Czapla


2 Answers

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.

like image 157
Piotr Czapla Avatar answered Nov 15 '22 06:11

Piotr Czapla


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.

like image 25
Gary Rowe Avatar answered Nov 15 '22 06:11

Gary Rowe