Tags with Jekyll and GitHub Pages

Coming from the Wordpress world, I’m used to easily work with tags and categories for blog posts. However, tags aren’t supported out of the box in Jekyll. Here is a nice Ruby plugin that will do the trick. But since my blog is published using GitHub Pages, and GitHub Pages doesn’t allow Ruby plugins, I can’t use this.

I found a solution by Brandon Parsons, where you create a tags page which gets populated with all used tags and links to posts. There is no way to dynamically create separate pages for each tag, but this should be good enough for me. If you really really want separate pages for each tag, there is a solution here.

Add tags to YAML front matter, and add a few lines of code to list all tags for the post. Code for the tags page can be found in Brandons blog post.

---
tags:
  jekyll
---
<ul>
  {% for tag in page.tags %}
  <li>
    <a href="/tags/#{{ tag }}">{{ tag }}</a>
  </li>
  {% endfor %}
</ul>
If you liked this post, you can share it with your followers or follow me on Twitter! Comments