commit 83c36880efde7948a14334fdad5547752e237381
parent 362d82285ccb9d033309e653084b8254f923392e
Author: Chris Bracken <chris@bracken.jp>
Date: Mon, 19 Aug 2019 22:20:45 -0700
Prefix posts with publication date
Prefixes pages of type "post" in list views with the publication date.
This ensures that while lists of tags, categories don't include a date
prefix, posts are formatted in list views as they are on the home page.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -3,7 +3,9 @@
<section id="posts">
<ol class="post-list">
{{- range .Pages }}
-<li><a href="{{ .Permalink }}">{{ .Title }}</a>
+<li>
+{{- if eq .Type "post" -}}{{ dateFormat "2006-01-02" .Date }}: {{ end -}}
+<a href="{{ .Permalink }}">{{ .Title }}</a>
{{- end }}
</ol>
</section>