Skip to content

Commit

Permalink
Only print article date if it is non-zero (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
imander committed Oct 1, 2021
1 parent 597a631 commit 1ae24ad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ <h1 class="f1 athelas mt3 mb1">
</p>
{{ end }}
{{/* 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 }}>
{{- .Date.Format "January 2, 2006" -}}
</time>
{{end}}

{{/*
Show "reading time" and "word count" but only if one of the following are true:
Expand Down

0 comments on commit 1ae24ad

Please sign in to comment.