Generate individual tag/category/author pages for your Jekyll website

I’ve been migrating more and more of my websites to Jekyll static sites, from Wordpress. The advantages are clear:

I created a personal Jekyll template for blog sites (with posts) and another Jekyll template for photography sites (with photos).

Tag/category indexes

One thing that I still had to solve was tag and category indexes. Wordpress does a great job of creating index pages for years, months, categories and tags. If your post uses the tag ‘apple’, it also shows up in the index page for the tag ‘apple’. All these pages help your SEO a lot.

Jekyll, on the other hand, only generates a web page for each .md or .html in the source. To get 100 different pages for 100 different tags, there need to be 100 source documents. No one wants to add/edit these by hand. Surely this could be automated, right? Thanks to my bashew bash script template, this was only one evening’s work.

Introducing jekyll_taxonomy


What does jekyll_taxonomy generate tag do?

‘build’ script

This is the script I’ve created to generate all my tags and categories for this blog in one go. The whole process (+- 600 posts, 50 categories, 500 tags) generates the pages in 15 seconds.

jekyll_taxonomy -c generate category ## recreate all category index pages
git add category  ## add any new category indexes to git
jekyll_taxonomy -c generate tag ## recreate all tag index pages
git add tag       ## add any new tag indexes to git
git status        ## show me all added/removed tags and categories

Jekyll will now have to generate an extra number (in my case: +- 550) of pages, and since all of these go through all your posts, the Jekyll generation process takes a lot longer, in my case up to 80 seconds. Big O notation for using this system of tag/category pages is O(n^2).

💬 github 🏷 jekyll🏷 static🏷 bash🏷 bashew🏷 wordpress