Moving from Octopress to a more modern version of Jeykll, getting categories up and working again has been a bit of a learning curve.

I want the urls to be human editable with something present at every level. I forego the usual url post structure for something simpler. In _config.yml I define :

permalink: /blog/:categories/:title:output_ext

The standard recommendation for Jeykll is to manually write the pages for your categories, I do not want to have to manage keeping those files in sync and adding or removing pages as Categories get updated. Therefor I am using the ‘jekyll-categories’ gem.

In _config.yml the category_dir variable needs to be set for this plugin.

category_dir: "blog"


group :jekyll_plugins do
  gem "jekyll-categories", "~> 0.0.2"

then run

> bundle

Create the post list for each category (_layouts/category__index.html) This will be used for pages matching /blog/:categories

layout: page

{% for post in site.categories[page.category] %}
<li><a href="{{ post.url | absolute_url }}">
      {{ post.title }}
{% endfor %}

My top level categories page does not use the plugin. Create a Categories index, categories.html This will be used for URLS matching /blog

layout: default
title: Categories
permalink: /blog/
{% for category in site.categories %}
<li><a href="{{ site.url }}/blog/{{ category | first | downcase | url_encode }}/">{{ category | first }}</a> ({{ category[1].size }})</li>
{% endfor %}