Skip to content

Commit

Permalink
Add anchor link to archive layout headers
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatelange committed May 1, 2024
1 parent 1750599 commit 33e48f9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions layouts/_default/archives.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,21 @@ <h1>
{{- range $pages.GroupByPublishDate "2006" }}
{{- if ne .Key "0001" }}
<div class="archive-year">
<h2 class="archive-year-header">
{{- replace .Key "0001" "" }}<sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup>
{{- $year := replace .Key "0001" "" }}
<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>
{{- range .Pages.GroupByDate "January" }}
<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">
{{- range .Pages }}
{{- if eq .Kind "page" }}
Expand Down

0 comments on commit 33e48f9

Please sign in to comment.