diff options
author | Jimmy Cai <jimmehcai@gmail.com> | 2020-09-09 18:35:22 +0300 |
---|---|---|
committer | Jimmy Cai <jimmehcai@gmail.com> | 2020-09-09 18:35:22 +0300 |
commit | 4d0e260318dc474e576c892df986ed4ee1d28495 (patch) | |
tree | 7b2a5ba096243ea61d3b6ec9475ce2ececb40b94 | |
parent | da112157cfbc7ce0f04842c6add5154679f64b10 (diff) |
feat(i18n): make dateFormat part of theme config
-rw-r--r-- | exampleSite/config.toml | 3 | ||||
-rw-r--r-- | layouts/partials/article-list/compact.html | 2 | ||||
-rw-r--r-- | layouts/partials/article/components/details.html | 2 | ||||
-rw-r--r-- | layouts/partials/article/components/footer.html | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c047d85..1071c32 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -13,6 +13,9 @@ DefaultContentLanguage = "en" # Theme i18n support [params] mainSections = ["post"] favicon = "" + [params.dateFormat] + published = "Jan 02, 2006" + lastUpdated = "Jan 02, 2006 15:04 MST" [params.sidebar] emoji = "🍥" avatar = "img/avatar.png" diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index 02fc0b3..3988b83 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -7,7 +7,7 @@ </h2> <footer class="article-time"> <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'> - {{- .Date.Format ( or .Site.Params.dateFormat "Jan 02, 2006" ) -}} + {{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} </time> </footer> </div> diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index 9c2517d..4349d61 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -33,7 +33,7 @@ <footer class="article-time"> {{ (resources.Get "icons/clock.svg").Content | safeHTML }} <time class="article-time--published"> - {{- .Date.Format ( or .Site.Params.dateFormat "Jan 02, 2006" ) -}} + {{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} </time> </footer> {{- end -}} diff --git a/layouts/partials/article/components/footer.html b/layouts/partials/article/components/footer.html index c6f80e5..0360a00 100644 --- a/layouts/partials/article/components/footer.html +++ b/layouts/partials/article/components/footer.html @@ -18,7 +18,7 @@ <section class="article-time"> {{ (resources.Get "icons/clock.svg").Content | safeHTML }} <span class="article-time--modified"> - {{ T "lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat "Jan 02, 2006 15:04 MST" ) }} + {{ T "lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }} </span> </section> {{- end -}} |