refactor: rename archive -> archives

This commit is contained in:
Jimmy Cai
2020-09-13 11:22:47 +02:00
parent c600f87213
commit 7379bbe412
10 changed files with 35 additions and 35 deletions
@@ -1,4 +1,4 @@
{{ define "body-class" }}template-archive{{ end }}
{{ define "body-class" }}template-archives{{ end }}
{{ define "main" }}
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if $categories }}
@@ -20,8 +20,8 @@
{{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archive-group" id="{{ $id }}">
<h3 class="archive-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
<div class="archives-group" id="{{ $id }}">
<h3 class="archives-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
<div class="article-list--compact">
{{ range .Pages }}
{{ partial "article-list/compact" . }}
@@ -1,28 +1,28 @@
<section class="widget archive">
<section class="widget archives">
<div class="widget-icon">
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
</div>
<h1 class="widget-title">{{ T "widgetArchiveTitle" }}</h1>
<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) }}
{{ $archive := $filtered.GroupByDate "2006" }}
{{ $archives := $filtered.GroupByDate "2006" }}
{{ range first .Site.Params.widgets.archive.limit ($archive) }}
{{ range first .Site.Params.widgets.archives.limit ($archives) }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archive-year">
<a href="{{ $.Site.Params.widgets.archive.path | relLangURL }}#{{ $id }}">
<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 $archive) .Site.Params.widgets.archive.limit }}
<div class="archive-year">
<a href="{{ $.Site.Params.widgets.archive.path | relLangURL }}">
<span class="year">{{ T "widgetArchiveMore" }}</span>
{{ 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 }}