mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 18:31:45 +01:00
29 lines
1.1 KiB
HTML
29 lines
1.1 KiB
HTML
<section class="widget archive">
|
|
<div class="widget-icon">
|
|
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
|
</div>
|
|
<h1 class="widget-title">Archive</h1>
|
|
|
|
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
|
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
|
{{ $filtered := ($pages | intersect $notHidden) }}
|
|
{{ $archive := $filtered.GroupByDate "2006" }}
|
|
|
|
{{ range first .Site.Params.widgets.archive.limit ($archive) }}
|
|
{{ $id := lower (replace .Key " " "-") }}
|
|
<div class="archive-year">
|
|
<a href="{{ $.Site.BaseURL }}{{ $.Site.Params.widgets.archive.path }}#{{ $id }}">
|
|
<span class="year">{{ .Key }}</span>
|
|
<span class="count">{{ len .Pages }}</span>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }}
|
|
<div class="archive-year">
|
|
<a href="{{ $.Site.BaseURL }}/archive">
|
|
<span class="year">More</span>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
</section>
|