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 %}
        <p>
            <b>{{ post.title }}</b>
            <p>{{ post.content }}</p>
        </p>
    {% endfor %}
{% endfor %}

Each element inside site.categories is a page element.

Posted by Victor Puertas on

Comments

comments powered by Disqus