summaryrefslogtreecommitdiff
path: root/templates/categories.html
diff options
context:
space:
mode:
authorDennis Fink2026-06-18 17:57:51 +0200
committerDennis Fink2026-06-18 17:57:51 +0200
commita4e35942fee745e64db5d0099ba2582e0fb4417e (patch)
treef109c3e77805cdacd6f443c8a2d47514be5254a2 /templates/categories.html
parente0904e48a5c1c5b327c29218fb39bf2fa05f1871 (diff)
downloaddennisfink.me-a4e35942fee745e64db5d0099ba2582e0fb4417e.tar.gz
dennisfink.me-a4e35942fee745e64db5d0099ba2582e0fb4417e.zip
Build the first usable version of the blog
This adds the Lektor project structure, models, templates, styling, feeds, categories, tags, archives, custom Markdown heading handling, and the initial content needed to make the blog usable.
Diffstat (limited to 'templates/categories.html')
-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 %}