Back to jekyll

1361268546000 » Tagged as: jekyll

So here I am, back on Jekyll but with a fresh start. Yep, started off by deleting the old stuff and making a clone of Jekyll-Base to lay the foundation. Next ran the wordpress to jekyll exporter plugin and downloaded the markdown. After that I remembered to start jekyll with the --auto option (eg jekyll --auto --server ) . If you don't do it that way, jekyll will not detect changes in your templates or markdown.

Jekyll was abandoned the last time  because it wanted plugins, yes dreaded plugins need to be installed to make jekyll behave the way I want it to. This plugin phobia is a direct result of suffering the Wordpress plugin system for many years. I wasn't keen for a repeat of that experience with Jekyll. Now after a full circle, it doesn't look as if I have any other choice, so here I am taking the plunge by choosing the category sidebar plugin by  Nikolay Sturmas as the first one to install.

I would have been very surprised if the first plugin worked as expected, it didn't (Liquid Exception: Unknown tag 'category_list' in post). It took a bit of head scratching  to figure out why something as simple as that wouldn't work. In the end the reason turns out to be that even though jekyll with the --auto param recognizes changes to templates or markdown, it will not detect  changes to plugin code. So when working with plugins, always remember to kill and restart the server for each change.

Next step was to generate the category pages. For that I initially used the example on the jekyll plugins wiki, and later switched to the one provided by the folks at Recursive design. Neither of these provide pagination, which is going to be addressed next, because even the home page isn't paginated by default.

Simple pagination can be enabled by adding paginate: <n> to the config.yml file. This uses the built in paginator. The result while usefull wasn't what I was looking for. It produces links like page2/, page3/ etc while permalink structure on the current blog is page/2/ , page/3/ etc . In other words, each page needs to be in it's own folder. There was a suggestion at bencurtis.com that one should just copy over the default pagination.rb file into the _plugins directory and edit line 32 to create a directory instead of a file. Since that post was written the pagination code has changed a bit and the line to be edited is now #40.

Modding the plugin ensures that the archives are correctly placed into separate sub directories but the link is still using the old page2/, page3/, page4/ ... format. To fix it, I needed to edit the template (which was borrowed from the jekyll wiki on pagination). The diff looks like this:

comments powered by Disqus