{% extends "base.html" %} {% block title %}All categories{% endblock %} {% block top_center %}

Categories

{% endblock %} {% block content %} {% set all_categories = [] %} {% for category, articles in categories %} {% if all_categories.append({'name': category.name, 'url': category.url, 'articles': articles|length()}) %} {% endif %} {% endfor %}
{# Sort by category frequency, then alphabetically #} {% for category in all_categories|sort(attribute='name')|sort(reverse=True, attribute='articles') %}
{{ category.name }}
{{ category.articles }} article{{ 's' if category.articles > 1 else '' }}
{% endfor %}
{% endblock %}