Add configuration option to change date format

This commit is contained in:
DaMoo 2019-03-07 14:31:02 -05:00
parent d7b27c55c2
commit ab1714b799
4 changed files with 6 additions and 2 deletions

View File

@ -97,6 +97,8 @@ paginate = 5
newerPosts = "Newer posts" newerPosts = "Newer posts"
olderPosts = "Older posts" olderPosts = "Older posts"
minuteReadingTime = "min read" minuteReadingTime = "min read"
dateFormatSingle = "2006-01-02"
dateFormatList = "2006-01-02"
[languages.en.params.logo] [languages.en.params.logo]
logoText = "hello friend" logoText = "hello friend"

View File

@ -26,6 +26,8 @@ paginate = 5
newerPosts = "Newer posts" newerPosts = "Newer posts"
olderPosts = "Older posts" olderPosts = "Older posts"
minuteReadingTime = "min read" minuteReadingTime = "min read"
dateFormatSingle = "2006-01-02"
dateFormatList = "2006-01-02"
[languages.en.params.logo] [languages.en.params.logo]
logoText = "hello friend" logoText = "hello friend"

View File

@ -9,7 +9,7 @@
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1> <h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<div class="post-meta"> <div class="post-meta">
<span class="post-date"> <span class="post-date">
{{ .Date.Format "2006-01-02" }} {{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
</span> </span>
{{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }} {{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }}
{{ if $.Site.Params.ShowReadingTime }} {{ if $.Site.Params.ShowReadingTime }}

View File

@ -4,7 +4,7 @@
<div class="post-meta"> <div class="post-meta">
{{ with .Date | default nil }} {{ with .Date | default nil }}
<span class="post-date"> <span class="post-date">
{{ .Format "2006-01-02" }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span> </span>
{{ end }} {{ end }}
{{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }} {{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }}