Dynamically list posts and tags in Jekyll

Mar 12, 2023 · 1 min read · Post a comment

As a follow-up post to Jekyll, dynamic links and JSON data, this time we are going to learn how to dynamically list posts and tags.


  • Jekyll



Open your HTML file where you want to list the posts URL and add the following code block:

{% for post in site.posts %}
    <li>{{ post.url }}</li>
{% endfor %}


The same thing with tags. We will list the tag size too, which means how many posts are there using the current tag.

{% for tag in site.tags %}
    <li>{{ tag[0] }} ({{ tag[1].size }})</li>
{% endfor %}


If you get stuck at some step, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.