Working with Tags in Jekyll

02 Jan, 2023

Jekyll has some powerful uses now with categories, tags, post, pages. I found a unique way to create a page just for one post.

The purpose for this was to have a better way to track and view all the posts for the #100DaysToOffload challenge.

Simple way for Jekyll to do this is:

{% for tag in site.tags %}
  {{ tag[0] }}
{% endfor %}

This will list all tags that have been used on the site. Lets take a live look below that I've limited to 5. Jeykll creates a new array so we need to call the array back in the for loop.

The site.tags has a condition you can pass long with the name of the tag: site.tags["100DaysToOffload"].

{% for post in site.tags["100DaysToOffload"] %}
  {{ post.title }}
{% endfor %}

In action we'll see the following post titles as well.

Lastly, lets see how to get the post counts. This is really simple! Reference the tag we want to get the size of site.tags["100DaysToOffload"] and then pipe over the size function.

The tag, 100DaysToOffload, has {{ site.tags["100DaysToOffload"] | size }} posts

The tag, 100DaysToOffload, has 0 posts

See my completed result here: 100 Days to Offload

I'm publishing this as part of 100 Days To Offload. You can join in yourself by visiting

Tags: jekyll, 100DaysToOffload


If there are replies, they will show below.

Found an issue? Edit on Github

← Back home