{% macro tags_category(category) %} {% for tag,articles in tags|sort %} {% for a in articles if a.category.name == category %} {% if loop.last %} {{ tag }} {{ loop.index }} {% endif %} {% endfor %} {% endfor %} {% endmacro %}