Show date in lists only if set by page (#154)

This commit is contained in:
Martin Hoefling 2019-05-05 21:56:33 +02:00 committed by Hanzei
parent 770fd5c0a6
commit 4c19d875de
2 changed files with 12 additions and 0 deletions

View file

@ -5,9 +5,15 @@
<div class="container"> <div class="container">
<ul> <ul>
{{ range .Pages.ByPublishDate.Reverse }} {{ range .Pages.ByPublishDate.Reverse }}
{{ if .Date }}
<li> <li>
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a>
</li> </li>
{{ else }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
</div> </div>

View file

@ -6,9 +6,15 @@
<div class="container"> <div class="container">
<ul> <ul>
{{ range .Pages.ByPublishDate.Reverse }} {{ range .Pages.ByPublishDate.Reverse }}
{{ if .Date }}
<li> <li>
<a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a>
</li> </li>
{{ else }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
</div> </div>