mirror of
https://github.com/loikein/hugo-tufte.git
synced 2024-11-16 21:36:56 +01:00
Add site parameters for long and short date formats
This commit is contained in:
parent
23b85481b6
commit
6fa3dfdb78
3 changed files with 16 additions and 2 deletions
|
@ -38,6 +38,10 @@ params:
|
||||||
# copyrightHolder: Copyright Holder
|
# copyrightHolder: Copyright Holder
|
||||||
# Show the "Powered by Hugo-Tufte and Hugo."
|
# Show the "Powered by Hugo-Tufte and Hugo."
|
||||||
showPoweredBy: false
|
showPoweredBy: false
|
||||||
|
# The format to use for short dates shown in lists of posts. Defaults to "Jan 02"
|
||||||
|
dateFormatShort: "Jan 02"
|
||||||
|
# The format to use for dates on posts. Defaults to "2006-01-02"
|
||||||
|
dateFormatLong: "2006-01-02"
|
||||||
# Site wide kill switch for date in pages
|
# Site wide kill switch for date in pages
|
||||||
hidedate: false
|
hidedate: false
|
||||||
# Site wide kill switch for post summary on home page
|
# Site wide kill switch for post summary on home page
|
||||||
|
|
|
@ -16,7 +16,12 @@
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<span class="list-date">{{ .Date.Format "Jan 2" }} ·</span>
|
<span class="list-date">
|
||||||
|
{{ if .Site.Params.dateFormatShort }}
|
||||||
|
{{ .Date.Format .Site.Params.dateFormatShort }}
|
||||||
|
{{ else }}
|
||||||
|
{{ .Date.Format "Jan 2" }}
|
||||||
|
{{ end }} ·</span>
|
||||||
<a href="{{ .RelPermalink }}">{{.Title}}</a>
|
<a href="{{ .RelPermalink }}">{{.Title}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -13,7 +13,12 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if not .Params.hidedate -}}
|
{{- if not .Params.hidedate -}}
|
||||||
<p class="date">{{ .Date.Format "2006-01-02" }}</p>
|
<p class="date">
|
||||||
|
{{ if .Site.Params.dateFormatLong }}
|
||||||
|
{{ .Date.Format .Site.Params.dateFormatLong }}
|
||||||
|
{{ else }}
|
||||||
|
{{ .Date.Format "2006-01-02" }}
|
||||||
|
{{ end }}</p>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if not .Params.hidereadtime -}}
|
{{- if not .Params.hidereadtime -}}
|
||||||
|
|
Loading…
Reference in a new issue