Add anchor link to archive layout headers

This commit is contained in:
Aditya Telange 2024-05-01 13:56:39 +05:30
parent 175059921f
commit 33e48f9892
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 12 additions and 3 deletions

View File

@ -36,12 +36,21 @@
{{- range $pages.GroupByPublishDate "2006" }} {{- range $pages.GroupByPublishDate "2006" }}
{{- if ne .Key "0001" }} {{- if ne .Key "0001" }}
<div class="archive-year"> <div class="archive-year">
<h2 class="archive-year-header"> {{- $year := replace .Key "0001" "" }}
{{- replace .Key "0001" "" }}<sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup> <h2 class="archive-year-header" id="{{ $year }}">
<a class="archive-header-link" href="#{{ $year }}">
{{- $year -}}
</a>
<sup class="archive-count">&nbsp;{{ len .Pages }}</sup>
</h2> </h2>
{{- range .Pages.GroupByDate "January" }} {{- range .Pages.GroupByDate "January" }}
<div class="archive-month"> <div class="archive-month">
<h3 class="archive-month-header">{{- .Key }}<sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup></h3> <h3 class="archive-month-header" id="{{ $year }}-{{ .Key }}">
<a class="archive-header-link" href="#{{ $year }}-{{ .Key }}">
{{- .Key -}}
</a>
<sup class="archive-count">&nbsp;{{ len .Pages }}</sup>
</h3>
<div class="archive-posts"> <div class="archive-posts">
{{- range .Pages }} {{- range .Pages }}
{{- if eq .Kind "page" }} {{- if eq .Kind "page" }}