diff options
author | Paul Duncan <pabs@pablotron.org> | 2021-10-16 11:32:50 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2021-10-16 11:32:50 -0400 |
commit | 998c07847b041217a3070b9287909f2e6f5b8f47 (patch) | |
tree | 3b5a8c12d0e98f3fde05e68d1f89d44b04994bfd /themes/hugo-pt2021/layouts/_default/archive.html | |
parent | 186152cf296c98acd8c57234fed9e532e56f78d8 (diff) | |
download | pablotron.org-998c07847b041217a3070b9287909f2e6f5b8f47.tar.bz2 pablotron.org-998c07847b041217a3070b9287909f2e6f5b8f47.zip |
themes/hugo-pt2021/layouts/_default/archive.html: add comments, add title, show post date
Diffstat (limited to 'themes/hugo-pt2021/layouts/_default/archive.html')
-rw-r--r-- | themes/hugo-pt2021/layouts/_default/archive.html | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/themes/hugo-pt2021/layouts/_default/archive.html b/themes/hugo-pt2021/layouts/_default/archive.html index 737fd94..5da6ae8 100644 --- a/themes/hugo-pt2021/layouts/_default/archive.html +++ b/themes/hugo-pt2021/layouts/_default/archive.html @@ -10,24 +10,50 @@ </h1><!-- title --> <div class='content'> + {{/* get all published posts */}} {{- $posts := where .Site.RegularPages "Section" "posts" -}} + + {{/* loop through posts by year */}} {{- range $posts.GroupByDate "2006" -}} + {{/* get year of first post (there will always be at least one) */}} {{- $head := index .Pages 0 -}} {{- $year := $head.Date.Format "2006" -}} - <h2 id='{{$year}}'>{{$year}}</h2> + + <h2 + id='{{$year}}' + title='Posts published in {{$year}}.' + aria-label='Posts published in {{$year}}.' + > + {{- $year -}} + </h2> + <ul> + {{/* loop through posts from this year */}} {{- range .Pages -}} <li> - <a + {{/* post link */}} + <a href='{{.Permalink}}' title='{{.Title}}' aria-label='{{.Title}}' > {{- .Title -}} - </a> + </a> - + + {{/* post date */}} + <span + class='date' + title='Date for "{{.Title}}".' + aria-label='Date for "{{.Title}}".' + > + {{- .Date.Format "January 2, 2006" -}} + </span><!-- date --> </li> {{- end -}} </ul> + {{- else -}} + {{/* no published posts */}} + No posts found. {{- end -}} </div><!-- content --> </div><!-- section --> |