Hugo-theme-stack/layouts/partials/widget/archive.html
2020-08-22 13:20:08 +02:00

20 lines
720 B
HTML

<section class="widget archive">
<div class="widget-icon">
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
</div>
<h1 class="widget-title">Archive</h1>
{{ $v1 := where .Site.RegularPages "Section" "post" }}
{{ $v2 := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := $v1 | intersect $v2 }}
{{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archive-year">
<a href="{{ $.Site.BaseURL }}/archive#{{ $id }}">
<span class="year">{{ .Key }}</span>
<span class="count">{{ len .Pages }}</span>
</a>
</div>
{{ end }}
</section>