Only print article date if it is non-zero (#397)

This commit is contained in:
Ian Anderson 2021-10-01 10:14:07 -07:00 committed by GitHub
parent 597a631988
commit 1ae24ada38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,9 +30,11 @@
</p> </p>
{{ end }} {{ end }}
{{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
{{ if not .Date.IsZero }}
<time class="f6 mv4 dib tracked" {{ printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}> <time class="f6 mv4 dib tracked" {{ printf `datetime="%s"` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}>
{{- .Date.Format "January 2, 2006" -}} {{- .Date.Format "January 2, 2006" -}}
</time> </time>
{{end}}
{{/* {{/*
Show "reading time" and "word count" but only if one of the following are true: Show "reading time" and "word count" but only if one of the following are true: