@@ -659,6 +659,42 @@ func buildHistory(ctx *PlanContext) ([]Item, error) {
659659 }
660660 }
661661 }
662+
663+ // Generate Archives Page
664+ var archiveContent bytes.Buffer
665+ archiveContent .WriteString ("# Archives\n \n " )
666+
667+ // Get years and sort them descending
668+ var years []string
669+ for y := range tree {
670+ years = append (years , y )
671+ }
672+ sort .Sort (sort .Reverse (sort .StringSlice (years )))
673+
674+ for _ , year := range years {
675+ archiveContent .WriteString (fmt .Sprintf ("## %s\n \n " , year ))
676+
677+ // Collect all days for this year
678+ var yearDays []dayEntry
679+ for _ , days := range tree [year ] {
680+ yearDays = append (yearDays , days ... )
681+ }
682+
683+ // Sort days descending
684+ sort .Slice (yearDays , func (i , j int ) bool {
685+ return yearDays [i ].DateStr > yearDays [j ].DateStr
686+ })
687+
688+ for _ , d := range yearDays {
689+ archiveContent .WriteString (fmt .Sprintf ("- [%s](%s)\n " , d .DateStr , d .Path ))
690+ }
691+ archiveContent .WriteString ("\n " )
692+ }
693+
694+ if err := renderAndWrite (ctx , archiveContent .Bytes (), time .Now (), filepath .Join (ctx .OutputDir , "archives" , "index.html" )); err != nil {
695+ return nil , err
696+ }
697+
662698 return rssItems , nil
663699}
664700
0 commit comments