From 5c476cba1ee51be046d5cd27ce2793630637c4ee Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Thu, 19 Aug 2021 12:21:34 +0200 Subject: [PATCH] Configure locale-based date formatting --- pelican_theme_teckids/pelicanconf.py | 5 +++++ pelican_theme_teckids/templates/archives.html | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pelican_theme_teckids/pelicanconf.py b/pelican_theme_teckids/pelicanconf.py index 3ed7709..4cb9f20 100644 --- a/pelican_theme_teckids/pelicanconf.py +++ b/pelican_theme_teckids/pelicanconf.py @@ -19,6 +19,11 @@ SLUGIFY_SOURCE = "basename" TIMEZONE = "Europe/Berlin" DEFAULT_LANG = "de" +DEFAULT_DATE_FORMAT = "%x" +DATE_FORMATS = { + "de": "%A, %d. %B %Y", + "en": "%A, %Y-%m-%d", +} # Feed generation is usually not desired when developing FEED_ALL_ATOM = None diff --git a/pelican_theme_teckids/templates/archives.html b/pelican_theme_teckids/templates/archives.html index d41ae5a..f3470da 100644 --- a/pelican_theme_teckids/templates/archives.html +++ b/pelican_theme_teckids/templates/archives.html @@ -10,12 +10,12 @@ {% if article.source_link %} {# This is a webring article #} <h2><a href="{{ article.link }}">{{ article.title }}</a></h2> - <p>{{ article.date|strftime('%Y-%m-%d') }} · <a href="{{ article.author_detail.href }}">{{ article.author_detail.name }}</a> · <a href="{{ article.source_link }}">{{ article.source_title }}</a></p> + <p>{{ article.date }} · <a href="{{ article.author_detail.href }}">{{ article.author_detail.name }}</a> · <a href="{{ article.source_link }}">{{ article.source_title }}</a></p> {{ article.description }} {% else %} {# This is a local article #} <h2><a href="{{ article.url }}">{{ article.title }}</a></h2> - <p>{{ article.date|strftime('%Y-%m-%d') }} · <a href="{{ article.author.url }}">{{ article.author }}</a></p> + <p>{{ article.date }} · <a href="{{ article.author.url }}">{{ article.author }}</a></p> {{ article.summary }} {% endif %} {% endfor %} -- GitLab