From ab7cdc5d3c20f03b1e22f4c201ba29af06d139cb Mon Sep 17 00:00:00 2001 From: "Sanjay T. Sharma" Date: Sun, 24 Sep 2017 17:56:55 +0100 Subject: [PATCH] feat: provide the facility to customize date format (#10) --- exampleSite/config.toml | 3 +++ layouts/_default/taxonomy.html | 2 +- layouts/partials/post/copyright.html | 2 +- layouts/post/single.html | 2 +- layouts/post/summary.html | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b6c06e9..f98d300 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -51,6 +51,9 @@ copyright = "" # default: author.name ↓ # 默认为下面配 # paginate of archives, tags and categories # 归档、标签、分类每页显示的文章数目 archive-paginate = 3 + + # The date format to use; for a list of valid formats, see https://gohugo.io/functions/format/ + dateFormatToUse = "2006-01-02" # show word count and read time ? # 是否显示字数统计与阅读时间 moreMeta = false diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index b2e4643..ec8a266 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -18,7 +18,7 @@ {{ range $paginator.Pages }}
- {{ .Date.Format "2006-01-02" }} + {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} diff --git a/layouts/partials/post/copyright.html b/layouts/partials/post/copyright.html index 813da5a..cbaefb7 100644 --- a/layouts/partials/post/copyright.html +++ b/layouts/partials/post/copyright.html @@ -7,7 +7,7 @@

{{ if $.Site.Params.linkToMarkDown -}} {{ with $.OutputFormats.Get "markdown" -}} diff --git a/layouts/post/single.html b/layouts/post/single.html index da83b70..7960c64 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -6,7 +6,7 @@

{{ .Title }}