inicio mail me! sindicaci;ón

The Mystery of Jekyll

I recently stumbled across the much-loved Jekyll, a “blog aware” website generator.

I say “blog aware” since i have yet to be convinced it is. Jekyll seems to work fine if you have a flat layout of _posts with topics, but as soon as you stray away from that, it begins to fall apart.

An Example

I’ll give you a real world example. This blog. Simply enough, i’ve got posts organised into categories. I’ve also got a few tags on the posts, though they are mainly intended for the website feed. After reading the Jekyll documentation, it says:

Categories are derived from the directory structure above the _posts directory. For example, a post at /work/code/_posts/2008-12-24-closures.textile would have this field set to ['work', 'code'].”

So i think “right, i’ll make folders for my existing categories then stick their posts into each respective _posts folder“.

ex-folders

This actually works rather well: if i list {{ site.posts }} from /index.html, each post gets listed with their .categories attribute set.

ex-bug

However if i list a posts .categories in the actual post, the list is mysteriously empty. It’s like Jekyll decided to make the categories act as some weird reverse breadcrumb system. Why this would be remotely useful, i have no idea.

The problem with how posts are listed gets further compounded when you start to use topics. All of my real blog posts are tagged “blog”, so in order to list them i actually use site.topics.blog. This works fine, until i try and list posts from within a “category”.

For some bizarre reason, the list of posts varies depending on which category you list from. For example, i have a /feed folder which contains an rss feed template. The only posts listed in the feed are those in my “dev” topic.

My only guess is that since alphabetically “d” comes before “f”, Jekyll is going through each category one-by-one and making posts on-the-fly. Pre-processing? We don’t need pre-processing!

The only real solution seems to be to store all of your posts in the top-level _posts folder, but that sort of defeats the purpose of using a folder-based category system.

Onto pagination and beyond!

Now assuming you have got your posts sorted out, you’ll probably want to paginate them, right? Well good luck with that; while Jekyll will allow you to split posts up into pages, the paginator is a global option. So if you want pages, you’ve got to have pages on everything.

Got multiple lists of posts on a single page? Well watch out, you could be in for a nasty surprise!

Which brings me onto the rather limited Liquid markup Jekyll uses. Now i don’t have much of an issue with the Liquid markup itself, after all i thought it was used rather well in Mephisto.

But in Jekyll, i’m constantly trying to find a workaround for its rather limited set of liquid tags. Want to list posts by date? How about multiple tags? Good luck with that!

So safe to say, unless you have a pretty simple blog with a flat layout then out-of-the-box Jekyll quite simply doesn’t cut it yet – sad but true.

blog comments powered by Disqus