From 998c07847b041217a3070b9287909f2e6f5b8f47 Mon Sep 17 00:00:00 2001
From: Paul Duncan <pabs@pablotron.org>
Date: Sat, 16 Oct 2021 11:32:50 -0400
Subject: themes/hugo-pt2021/layouts/_default/archive.html: add comments, add
 title, show post date

---
 themes/hugo-pt2021/layouts/_default/archive.html | 32 +++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

(limited to 'themes/hugo-pt2021')

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 -->
-- 
cgit v1.2.3