Added new dateFormat and set visible dates to reference it. Defaults to existing format: 2006-01-02.

This commit is contained in:
Jordan Brough 2022-03-06 14:11:38 -07:00
parent 9d458d193f
commit 0f6b97db32
5 changed files with 8 additions and 4 deletions

View File

@ -143,6 +143,9 @@ paginate = 5
# With this option you don't have to put the `cover` param in a front-matter.
autoCover = true
# Provide a string as a date format. By default, 2006-01-02. See https://pkg.go.dev/github.com/vigneshuvi/GoDateFormat "Constants and Placeholders" for more information.
dateFormat = "01-02-2006"
# set post to show the last updated
# If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated
showLastUpdated = false

View File

@ -9,6 +9,7 @@ paginate = 5
showMenuItems = 2
fullWidthTheme = false
centerTheme = false
dateFormat = "2006-01-02"
[languages]
[languages.en]

View File

@ -21,7 +21,7 @@
</h1>
<div class="post-meta">
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ .Date.Format $.Site.Params.dateFormat }}
</span>
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>

View File

@ -12,7 +12,7 @@
</h1>
<div class="post-meta">
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ .Date.Format $.Site.Params.dateFormat }}
</span>
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>

View File

@ -5,9 +5,9 @@
<div class="post-meta">
{{ if .Params.Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ .Date.Format $.Site.Params.dateFormat }}
{{ if $.Site.Params.showLastUpdated }}
[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]
[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format $.Site.Params.dateFormat }}]
{{ end }}
</span>
{{ end }}