diff options
author | Akira Baruah <akira.baruah@gmail.com> | 2021-04-05 23:47:59 -0700 |
---|---|---|
committer | Jan Raasch <jan@janraasch.com> | 2021-04-12 17:18:41 +0200 |
commit | be0ba327e3a0615d81e58e77c88a67682df01b77 (patch) | |
tree | f720f2ffa405cd34706512d7fb68409ba80cebc4 /layouts | |
parent | b1fc6d298f7206b0e33f15b159fcd253f118f8c5 (diff) | |
download | hugo-bearcub-be0ba327e3a0615d81e58e77c88a67682df01b77.tar.gz hugo-bearcub-be0ba327e3a0615d81e58e77c88a67682df01b77.tar.bz2 |
feat: enable optional custom date format
Adds a .Site.Params.dateFormat setting to let users specify a Hugo-style
date format string for content. Previously, the date format was
hardcoded to "02 Jan, 2006", presumably to match the original BearBlog
style. This format gets used by default if the new "dateFormat" setting
is absent from the site config.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 2 | ||||
-rw-r--r-- | layouts/_default/single.html | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 2545d9a..8b8c14b 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -12,7 +12,7 @@ <span> <i> <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate> - {{ .Date.Format "02 Jan, 2006" }} + {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }} </time> </i> </span> diff --git a/layouts/_default/single.html b/layouts/_default/single.html index f993a0c..7d57351 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@ <p> <i> <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate> - {{ .Date.Format "02 Jan, 2006" }} + {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }} </time> </i> </p> |