From 9d76ab371fe419110cb705444191a22749182ba1 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sun, 20 Sep 2020 13:26:10 +0200 Subject: [PATCH] feat(archive widget): improve "more" link Link it to the next available year --- layouts/partials/widget/archives.html | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html index de80ee5..82bdbf5 100644 --- a/layouts/partials/widget/archives.html +++ b/layouts/partials/widget/archives.html @@ -9,20 +9,16 @@ {{ $filtered := ($pages | intersect $notHidden) }} {{ $archives := $filtered.GroupByDate "2006" }} - {{ range first .Site.Params.widgets.archives.limit ($archives) }} - {{ $id := lower (replace .Key " " "-") }} + {{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }} + {{- $id := lower (replace $item.Key " " "-") -}}
- {{ .Key }} - {{ len .Pages }} - -
- {{ end }} - - {{ if gt (len $archives) .Site.Params.widgets.archives.limit }} -
- - {{ T "widgetArchivesMore" }} + {{ if eq $index $.Site.Params.widgets.archives.limit }} + {{ T "widgetArchivesMore" }} + {{ else }} + {{ .Key }} + {{ len $item.Pages }} + {{ end }}
{{ end }}