chiark / gitweb /
theme: make article date splitting more robust.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 12:59:19 +0000 (14:59 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 13:58:13 +0000 (15:58 +0200)
This could fail in case there are spaces in some of the generated
values. Still not ideal, should be made configurable (locale-dependent
order etc).

pelican-theme/templates/article_header.html

index 57ec83c627f41bc7b628bd695e645495a8fa9038..2ec0e1d218f1af9196a22446a6578652e0897f0d 100644 (file)
@@ -1,8 +1,10 @@
 <header>
   <h1><a href="{{ article.url|format_siteurl|e }}" rel="bookmark" title="Permalink to {{ article.title }}">
     <time class="m-date" datetime="{{ article.date.isoformat() }}">
-      {% set month, day, year = article.date.strftime('%b %d %Y').split(' ') %}
-      {{ month }} <span class="m-date-day">{{ day }}</span> {{year}}
+      {% set month = article.date.strftime('%b') %}
+      {% set day = article.date.strftime('%d') %}
+      {% set year = article.date.strftime('%Y') %}
+      {{ month }} <span class="m-date-day">{{ day }}</span> {{ year }}
     </time>
     {{ article.title }}
     {% if article.status == 'draft' %}