aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.toml3
-rw-r--r--layouts/_default/taxonomy.html2
-rw-r--r--layouts/partials/post/copyright.html2
-rw-r--r--layouts/post/single.html2
-rw-r--r--layouts/post/summary.html2
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 }}
<div class="archive-post">
<span class="archive-post-time">
- {{ .Date.Format "2006-01-02" }}
+ {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
</span>
<span class="archive-post-title">
<a href="{{ .URL }}" class="archive-post-link">
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 @@
</p>
<p class="copyright-item">
<span class="item-title">{{ $lang.copyright.lastMod }}</span>
- <span class="item-content">{{ .Lastmod.Format "2006-01-02" }}</span>
+ <span class="item-content">{{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</span>
</p>
{{ 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 @@
<h1 class="post-title">{{ .Title }}</h1>
<div class="post-meta">
- <span class="post-time"> {{ .Date.Format "2006-01-02" }} </span>
+ <span class="post-time"> {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} </span>
{{ with .Params.categories -}}
<div class="post-category">
{{ range . -}}
diff --git a/layouts/post/summary.html b/layouts/post/summary.html
index 2cdb7b3..be4366b 100644
--- a/layouts/post/summary.html
+++ b/layouts/post/summary.html
@@ -3,7 +3,7 @@
<header class="post-header">
<h1 class="post-title"><a class="post-link" href="{{ .URL }}">{{ .Title }}</a></h1>
<div class="post-meta">
- <span class="post-time"> {{ .Date.Format "2006-01-02" }} </span>
+ <span class="post-time"> {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} </span>
{{ with .Params.categories -}}
<div class="post-category">
{{ range . -}}