Make date format configurable
Alan Pearce alan@alanpearce.eu
Tue, 18 Apr 2023 09:29:56 +0200
5 files changed, 5 insertions(+), 3 deletions(-)
M config.toml → config.toml
@@ -19,6 +19,7 @@ # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola highlight_code = true [extra] +date_format="%d %b, %Y" [[extra.main_menu]] name = "Bear"
M templates/page.html → templates/page.html
@@ -11,7 +11,7 @@ {%- if page.date %} <p> <i> <time datetime='{{ page.date | date(format='%+') }}' pubdate> - {{ page.date | date(format="%d %b, %Y") }} + {{ page.date | date(format=config.extra.date_format) }} </time> </i> </p>
M templates/section.html → templates/section.html
@@ -14,7 +14,7 @@ <li> <span> <i> <time datetime='{{ page.date | date(format='%+') }}' pubdate> - {{ page.date | date(format="%d %b, %Y") }} + {{ page.date | date(format=config.extra.date_format) }} </time> </i> </span>
M templates/taxonomy_single.html → templates/taxonomy_single.html
@@ -14,7 +14,7 @@ <li> <span> <i> <time datetime='{{ page.date | date(format='%+') }}' pubdate> - {{ page.date | date(format="%d %b, %Y") }} + {{ page.date | date(format=config.extra.date_format) }} </time> </i> </span>
M theme.toml → theme.toml
@@ -12,6 +12,7 @@ # You don't need to prefix variables by the theme name but as this will # be merged with user data, some kind of prefix or nesting is preferable # Use snake_casing to be consistent with the rest of Zola [extra] +date_format="%d %b, %Y" [author] name = "Alan Pearce"