From ee747de48559c5d5558ceda84e915136dfb197ad Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Wed, 19 Apr 2023 15:31:43 +0200 Subject: [PATCH] post date format in config --- config.yaml | 1 + layouts/partials/blocks/templates/posts/highlight.html | 2 +- layouts/partials/posts/post-infos.html | 2 +- layouts/partials/posts/post.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 1f388d9a..a931be19 100644 --- a/config.yaml +++ b/config.yaml @@ -9,6 +9,7 @@ params: plausible: posts: default_image: false + date_format: ":date_long" index: show_categories: false show_author: false diff --git a/layouts/partials/blocks/templates/posts/highlight.html b/layouts/partials/blocks/templates/posts/highlight.html index 3e1f8d8b..f7f857bb 100644 --- a/layouts/partials/blocks/templates/posts/highlight.html +++ b/layouts/partials/blocks/templates/posts/highlight.html @@ -38,7 +38,7 @@ {{- end -}} <div class="post-meta"> - <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format ":date_long" }}</time> + <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> {{ if site.Params.posts.index.show_author }} {{- partial "posts/author" . -}} {{ end }} diff --git a/layouts/partials/posts/post-infos.html b/layouts/partials/posts/post-infos.html index 4c576b7d..c47936dd 100644 --- a/layouts/partials/posts/post-infos.html +++ b/layouts/partials/posts/post-infos.html @@ -13,7 +13,7 @@ {{ end }} <li> <span>{{ i18n "posts.date" }}</span> - <time datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format ":date_long" }}</time> + <time datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> </li> {{ range .GetTerms "authors" }} <li> diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html index e1dcc3b6..37da4637 100644 --- a/layouts/partials/posts/post.html +++ b/layouts/partials/posts/post.html @@ -32,7 +32,7 @@ {{- end -}} <div class="post-meta"> - <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format ":date_long" }}</time> + <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time> {{ if site.Params.posts.index.show_author }} {{- partial "posts/author" . -}} {{ end }} -- GitLab