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

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/widget/archives.html')
-rw-r--r--layouts/partials/widget/archives.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html
new file mode 100644
index 0000000..de80ee5
--- /dev/null
+++ b/layouts/partials/widget/archives.html
@@ -0,0 +1,29 @@
+<section class="widget archives">
+ <div class="widget-icon">
+ {{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
+ </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 first .Site.Params.widgets.archives.limit ($archives) }}
+ {{ $id := lower (replace .Key " " "-") }}
+ <div class="archives-year">
+ <a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
+ <span class="year">{{ .Key }}</span>
+ <span class="count">{{ len .Pages }}</span>
+ </a>
+ </div>
+ {{ end }}
+
+ {{ if gt (len $archives) .Site.Params.widgets.archives.limit }}
+ <div class="archives-year">
+ <a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}">
+ <span class="year">{{ T "widgetArchivesMore" }}</span>
+ </a>
+ </div>
+ {{ end }}
+</section>