From af59e93d2544b6172101d606356a7f5c7b00d60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 26 Jul 2022 21:41:07 +0800 Subject: [PATCH] :wrench: Add special list for archives articles show. --- layouts/_default/list.html | 34 +++++----------------------------- layouts/_default/section.html | 3 +++ layouts/partials/init.html | 3 +++ layouts/partials/list.html | 29 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 layouts/partials/list.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 35c4d71..3a56b50 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,29 +1,5 @@ -{{ range .Paginator.Pages.GroupByDate "2006" }} -
- {{ .Key }} -
-{{ range .Pages }} -
-
- -
- {{- if isset .Params "extlink" }} - - {{- .Title -}} - - - {{- else }} - - {{- end }} -
-
-
-{{ end }} -{{ end }} \ No newline at end of file +{{- if and .Page.IsSection (eq .Section "archives") }} + {{ partial "list.html" ((.Paginator (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006") }} +{{- else }} + {{ partial "list.html" (.Paginator.Pages.GroupByDate "2006") }} +{{- end }} diff --git a/layouts/_default/section.html b/layouts/_default/section.html index a9bce65..9e73648 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -8,6 +8,9 @@
{{- $cheers := "Um" }} {{- $posts := .Scratch.Get "postsCount" }} + {{- if and .Page.IsSection (ne .Section "archives") }} + {{- $posts = .Scratch.Get .Section }} + {{- end }} {{- if gt $posts 210 }} {{- $cheers = "Excellent" }} {{- else if gt $posts 130 }} diff --git a/layouts/partials/init.html b/layouts/partials/init.html index 4b51080..723603f 100644 --- a/layouts/partials/init.html +++ b/layouts/partials/init.html @@ -8,6 +8,9 @@ {{ $globalVars := newScratch }} {{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }} +{{ range .Site.Params.mainSections }} + {{ $globalVars.Set . (len (where $.Page.Site.RegularPages "Section" .))}} +{{ end }} {{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }} {{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }} diff --git a/layouts/partials/list.html b/layouts/partials/list.html new file mode 100644 index 0000000..7ddf390 --- /dev/null +++ b/layouts/partials/list.html @@ -0,0 +1,29 @@ +{{ range . }} +
+ {{ .Key }} +
+{{ range .Pages }} + +{{ end }} +{{ end }} \ No newline at end of file