Screenshots
Default date format:
Default date format when date != lastmod
:
My preferred yyyy-mm-dd
format:
My preferred date format when date != lastmod
.
Site date_format parameter
In config/_defaults/params.yaml
.
Default:
date_format: 'Jan 2, 2006'
Custom:
date_format: '2006-01-02'
Template override
This is the changes I made in my site’s layouts/partials/page_metadata.html
template override.
diff -u /home/alex/Code/{External/wowchemy-hugo-modules/wowchemy,Personal/blogue}/layouts/partials/page_metadata.html
--- /home/alex/Code/External/wowchemy-hugo-modules/wowchemy/layouts/partials/page_metadata.html 2021-10-30 22:56:06.876349037 -0400
+++ /home/alex/Code/Personal/blogue/layouts/partials/page_metadata.html 2021-10-30 23:36:03.862866240 -0400
@@ -15,15 +15,15 @@
{{ if not (in (slice "event" "page") $page.Type) }}
<span class="article-date">
- {{ $date := $page.Lastmod.Format site.Params.date_format }}
{{ if eq $page.Type "publication" }}
- {{ $date = $page.Date.Format (site.Params.publications.date_format | default "January, 2006") }}
+ {{ $page.Date.Format (site.Params.publications.date_format | default "January, 2006") }}
{{ else }}
+ {{ $page.Date.Format site.Params.date_format }}
{{ if ne $page.Params.Lastmod $page.Params.Date }}
- {{ i18n "last_updated" }}
+ / updated
+ {{ $page.Lastmod.Format site.Params.date_format }}
{{ end }}
{{ end }}
- {{ $date }}
</span>
{{ end }}
GitHub issue
https://github.com/wowchemy/wowchemy-hugo-themes/issues/2064