mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 18:31:45 +01:00
25 lines
1.1 KiB
HTML
25 lines
1.1 KiB
HTML
<section class="widget archives">
|
|
<div class="widget-icon">
|
|
{{ partial "helper/icon" "infinity" }}
|
|
</div>
|
|
<h1 class="widget-title">{{ T "widgetArchivesTitle" }}</h1>
|
|
|
|
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
|
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
|
{{ $filtered := ($pages | intersect $notHidden) }}
|
|
{{ $archives := $filtered.GroupByDate "2006" }}
|
|
|
|
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
|
|
{{- $id := lower (replace $item.Key " " "-") -}}
|
|
<div class="archives-year">
|
|
<a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
|
|
{{ if eq $index $.Site.Params.widgets.archives.limit }}
|
|
<span class="year">{{ T "widgetArchivesMore" }}</span>
|
|
{{ else }}
|
|
<span class="year">{{ .Key }}</span>
|
|
<span class="count">{{ len $item.Pages }}</span>
|
|
{{ end }}
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
</section>
|