aboutsummaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/hugo-pt2021/layouts/_default/archive.html32
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 -->