Add dateFormat option. Close #5

This commit is contained in:
Dmitry Kolosov 2020-05-24 22:55:32 +03:00
parent 63b73e6d2b
commit 391fe8e5b1
3 changed files with 13 additions and 2 deletions

View File

@ -54,6 +54,7 @@ params:
- images/og-featured.png
customCSS:
- css/my.css
dateFormat: "2006-01-02"
```
### Check your site

View File

@ -1,5 +1,10 @@
{{ $dateFormat := "2006-01-02" }}
{{ if .Site.Params.dateFormat }}
{{ $dateFormat = .Site.Params.dateFormat }}
{{ end }}
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
<div class="article-date">{{ .Params.date.Format $dateFormat }}</div>
{{ end }}
</div>

View File

@ -1,6 +1,11 @@
{{ $dateFormat := "2006-01-02" }}
{{ if .Site.Params.dateFormat }}
{{ $dateFormat = .Site.Params.dateFormat }}
{{ end }}
<div class="article-info">
{{ if .Params.date }}
<div class="article-date">{{ .Params.date.Format "2006-01-02" }}</div>
<div class="article-date">{{ .Params.date.Format $dateFormat }}</div>
{{ end }}
<div class="article-taxonomies">
{{ if .Params.categories }}