How to get the categories of your posts?

This is a simple snippet that explain to you how the get your posts' categories. Similar way for getting the tags of your posts:

layout: default
title: Categories
{% for categorie, posts in site.categories %}
    <h3>{{ categorie }}</h3>

    {% for post in posts %}
            <b>{{ post.title }}</b>
            <p>{{ post.content }}</p>
    {% endfor %}
{% endfor %}

Each element inside site.categories is a page element.

Posted by Victor Puertas on


comments powered by Disqus