- archives.html: Link the "Archives" title to the archives page, consistent with how individual year links already work - taxonomy.html: Change showLink default from false to true so tag-cloud and categories widget titles link to their taxonomy listing pages by default Widget titles are the primary affordance users interact with, so linking them to the full listing page improves navigation. The showLink param can still be set to false to disable this. Co-authored-by: delize <4028612+delize@users.noreply.github.com>
37 lines
1.5 KiB
HTML
37 lines
1.5 KiB
HTML
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "archives") -}}
|
|
{{- $context := .Context -}}
|
|
{{- $limit := default 5 .Params.limit -}}
|
|
{{- if $query -}}
|
|
{{- $archivesPage := index $query 0 -}}
|
|
<section class="widget archives">
|
|
<div class="widget-icon">
|
|
{{ partial "helper/icon" "infinity" }}
|
|
</div>
|
|
<h2 class="widget-title section-title">
|
|
<a href="{{ $archivesPage.RelPermalink }}">
|
|
{{ T "widget.archives.title" }}
|
|
</a>
|
|
</h2>
|
|
|
|
{{ $pages := partial "helper/pages.html" $context.Site.Home }}
|
|
{{ $archives := $pages.GroupByDate "2006" }}
|
|
|
|
<div class="widget-archive--list">
|
|
{{ range $index, $item := first (add $limit 1) ($archives) }}
|
|
{{- $id := lower (replace $item.Key " " "-") -}}
|
|
<div class="archives-year">
|
|
<a href="{{ $archivesPage.RelPermalink }}#{{ $id }}">
|
|
{{ if eq $index $limit }}
|
|
<span class="year">{{ T "widget.archives.more" }}</span>
|
|
{{ else }}
|
|
<span class="year">{{ .Key }}</span>
|
|
<span class="count">{{ len $item.Pages }}</span>
|
|
{{ end }}
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</section>
|
|
{{- else -}}
|
|
{{- warnf "Archives page not found. Create a page with layout: archives." -}}
|
|
{{- end -}} |