diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 78ffb75..43cd18b 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -19,8 +19,8 @@ hasCJKLanguage = true Profiles, backgrounds, favorite things etc. """ publicationYear = "2019" - listPageDateFormat = "January, 2006" # See https://gohugo.io/functions/format/ - singlePageDateFormat = "January 2, 2006" + # listPageDateFormat = "January, 2006" # See https://gohugo.io/functions/format/ + # singlePageDateFormat = "January 2, 2006" # custom_css = ["/css/custom.css"] # custom_js = ["/js/custom.js"] diff --git a/layouts/_default/list.html b/layouts/_default/list.html index fb53e88..f98242d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -9,7 +9,8 @@
- {{ range $index, $value := .Pages.GroupByDate .Site.Params.listPageDateFormat }} + {{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}} + {{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }} {{ if (ne $index 0) }}
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 8e89719..ea6919a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,7 +2,8 @@

{{ .Title }}

{{ partial "header.html" . }} -

{{ .Date.Format .Site.Params.singlePageDateFormat }}

+ {{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}} +

{{ .Date.Format $singlePageDateFormat }}

{{ .Content }}