Tags are a bit feature for blogs, and one I missed the most when moving from dynamically generated blogs (like Wordpress or Tumblr) to Jekyll on GitHub pages. I must say that it is very easy to have tags in a Jekyll blog if you build it locally (there are hundreds of plugins dedicated to handling tags), however I prefer to have GitHub pages generate my blog directly from my repository. The only problem with this is that GitHub pages runs Jekyll in “safe mode”, meaning no plugins (for the sake of being accurate, a really small amount of plugins is supported).
I have found several different workarounds on the web to have tags and let GitHub generate my blog, some required a lot of manual work, some were simpler. In the end, I settled with this easy, but really basic solution I found here.
The steps were easy, really:
- Make sure to add tags to the YAML front matter of each blog post.
- Create a “tags.md” page and paste the code provided at the link above.
- Add a link to the tags page, so it can be reached easily by users.
- Add to the post.html layout a bit of code that would show each post’s tag in the “meta” area.
And voilà! Here is my brand new tags page.
I am not 100% happy with this solution, but it will do for now.