Hugo-theme-stack/layouts/partials/widget/archives.html

26 lines
1.1 KiB
HTML
Raw Normal View History

2020-09-13 05:22:47 -04:00
<section class="widget archives">
2020-08-22 07:20:08 -04:00
<div class="widget-icon">
2020-10-09 18:27:56 -04:00
{{ partial "helper/icon" "infinity" }}
2020-08-22 07:20:08 -04:00
</div>
2020-09-13 05:22:47 -04:00
<h1 class="widget-title">{{ T "widgetArchivesTitle" }}</h1>
2020-08-22 07:20:08 -04:00
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
2020-09-13 05:22:47 -04:00
{{ $archives := $filtered.GroupByDate "2006" }}
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
{{- $id := lower (replace $item.Key " " "-") -}}
2020-09-13 05:22:47 -04:00
<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 }}
2020-08-22 07:20:08 -04:00
</section>