21 December 2015

Jekyll is known as a hacker’s blog parser for a reason and that is because you have to fix its problems yourself to get it to work. The satisfaction you will get from not having to rely on other blogging platforms and their associated overhead will make it worthwhile. There is also a large community that can help you.

While creating content, I encountered an obscure error like

Liquid Exception: undefined method `t' for nil:NilClass in blog/categories/tips/index.html

The reason for this was due to the way I was processing truncated content to show post previews for my categories page. I had a value of 50 for the truncation and changing that to 40 words solved the problem.

In other words, a certain amount of normal text must first be present before a code section processed by highlight is allowed.

My content was using a Liquid {% highlight swift %} tag that happened to occur after a certain amount of introductory text. Therefore, the error was dependent upon the length of the text preceding the highlight tag as well as the truncation value used to display excerpted text.

As you can see, the error message perfectly describes that situation. 😏

No, the error kind of gets you into the general region, but it takes much more understanding to know how to fix the problem.

I debugged this problem by clearing out _site and then using jekyll b --trace. I then found in the source of blog/categories/tips/index.html an improper handling of a Liquid tag within the truncated excerpt.

blog comments powered by Disqus