I have just switched two blogs over to use Octopress, both dotnetguy.co.uk and also paz.am/blog.
One thing that was missing “out of the box” was the ability to include a list of categories in the sidebar with a link. Fortunately Octopress (well actually Jekyll) is written in such away that creating a plug-in to do this is very simple.
Firstly we need to write a little ruby code. Add a file to the plugins directory called category_list_tag.rb. This plug-in will take the category data from the site and generate list items for each category. On line 17 the category_list tag is then registered and made available to the liquid templating engine.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Now we need to create the category list (category_list.html) template in source/_includes/asides. We now use the “category_list” tag we registered in the plug-in above.
1 2 3 4 5 6 | |
Finally we just need to add the new sidebar template to the default_asides configuration within the _config.yml.
1
| |
And that’s all she wrote! I think Octopress / Jekyll is an excellent blog engine / static site generator, and being able to hack away and write simple plug-ins quickly makes it my number one choice… for now.