summaryrefslogtreecommitdiff
path: root/templates/categories.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/categories.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/templates/categories.html b/templates/categories.html
new file mode 100644
index 0000000..4dbdf1a
--- /dev/null
+++ b/templates/categories.html
@@ -0,0 +1,53 @@
+{% extends "base.html" %}
+
+{% block meta %}
+ {{ super() }}
+ <meta property="og:type" content="website">
+{% endblock %}
+{% block styles %}
+ {{ super() }}
+ <link rel="stylesheet"
+ type="text/css"
+ href="{{ '/static/css/categories.css'|asseturl }}">
+{% endblock %}
+{% set title = "Categories" %}
+{% block content %}
+ <article>
+ <header>
+ <h2>Categories</h2>
+ </header>
+ <ul>
+ {% set sorted = [] %}
+ {% for category in this.children.order_by('name') %}
+ {% set post_count = category.children.count() %}
+ {% if post_count > 0 %}
+ {% set _ = sorted.append((post_count, category)) %}
+ {% endif %}
+ {% endfor %}
+ {% for post_count, category in sorted|sort(attribute='0', reverse=True) %}
+ {% set last_post = category.children.order_by('-publication_date').first() %}
+ <li>
+ <a href="{{ category|url }}">
+ <h3>{{ category.name }}</h3>
+ <dl>
+ <div>
+ <dt>Posts:</dt>
+ <dd>
+ {{ post_count }}
+ </dd>
+ </div>
+ {% if last_post %}
+ <div>
+ <dt>Last post:</dt>
+ <dd>
+ <time datetime="{{ last_post.publication_date }}">{{ last_post.publication_date }}</time>
+ </dd>
+ </div>
+ {% endif %}
+ </dl>
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </article>
+{% endblock %}