Welcome to mirror list, hosted at ThFree Co, Russian Federation.

archives.html « widget « partials « layouts - github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6950a47a39bad174f8a1933a96924d2f9008bc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<section class="widget archives">
    <div class="widget-icon">
        {{ partial "helper/icon" "infinity" }}
    </div>
    <h2 class="widget-title section-title">{{ T "widgetArchivesTitle" }}</h2>

    {{ $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>