Phil’s Blog

Disce, ludere, creare. Soli Deo gloria.

Adding tags

This post was written when this blog was based on Jekyll before I moved back to WordPress. I have kept it as part of the history of this blog.

It’s taken me a long time with lots of googling and trial & error, but I finally have tags working on this site.

Out of the box Jekyll provides a tagging function. You can define tags at the start of blog posts along with the other data you wish to add, but annoyingly Jekyll doesn’t automatically provide archive pages.

When I first built this version of my site I started to add tags to my blog posts. I managed to figure out how to display them on each posts page but that was as far as I got. I made a couple of attempts at adding the functionality I wanted to the tags in the form of a page for each tag that lists the post attached to the tag. I wanted people to be able to click on the tags at the bottom of the posts and go to the tag page, and I wanted to list all the tags in use on the site in the archive page.

Finally today I came across this list of Jekyll plugins. In the list was a plugin designed to generate archive pages for years, months, days, categories, and tags. With the aim of todays tinkering focused on getting tags working I limited the archive plugin to just generate the pages for tags. Joyfully it worked first time. It took me some playing around with the templates to get them looking how I wanted, but I had pages generated for each tag and links to each page from the bottom of the posts.

The final task was getting a list of tags on the archive page. It took a lot of googling and faffing but eventually I managed to achieve what I wanted.

Now I just have to spend a bit of time making sure everything is tagged up as I want before I can explore how to make use of the tags in other ways.