Merge pull request #40 from da-moo/master

Add configuration option to change date format
This commit is contained in:
Radek Kozieł 2019-03-11 18:54:26 +01:00 committed by GitHub
commit 1cfec04653
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 }}