From 13a2c8742c3a34ef8d137b78e5209b3d4acb02cc Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 02:06:21 +0800 Subject: WIP: newsletter section page and archives page can work --- layouts/_default/list.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'layouts/_default/list.html') diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e2c248c..f92963d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -13,6 +13,11 @@ {{ .Description | markdownify }} {{- end }} + {{- with .Param "archivesSlug" }} +
+ Archives +
+ {{- end }} {{- end }} -- cgit v1.2.3 From a016d836633b6e223d1ac3ee0ddb262eca0d626d Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 7 Sep 2022 13:53:15 +0800 Subject: home page filter pages use "Section in" instead of "Type in" distinguish .Section and .Type --- layouts/_default/list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layouts/_default/list.html') diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f92963d..5797a30 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,7 +32,7 @@ {{- $pages := .Pages }} {{- if .IsHome }} - {{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} + {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections }} {{- end }} {{- $pages = where $pages "Params.hidden" "!=" true }} -- cgit v1.2.3 From d9c228117bff094eb3545999364a8533f141467d Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 8 Sep 2022 00:25:50 +0800 Subject: fix all pages query issues in: list, archives, newsletter section, post_nav_links --- layouts/_default/archives.html | 7 ++++--- layouts/_default/list.html | 1 + layouts/newsletter/section.html | 4 +--- layouts/partials/post_nav_links.html | 9 ++++++++- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'layouts/_default/list.html') diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index 285b592..dd53699 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -9,12 +9,13 @@ {{- end }} +{{/* get pages from the current page's section */}} +{{/* in this way, archives.html could be used for section archives other than the only one archives of the whole site */}} {{- $sections := site.Params.mainSections }} -{{/* with the follow condition, archives.html could be used for section archives other than the only one archives of the whole site */}} {{- if .Section }} - {{- $sections = .Section}} + {{- $sections = slice .Section }} {{- end }} -{{- $pages := where site.AllPages "Type" "in" $sections }} +{{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }} {{- range $pages.GroupByPublishDate "2006" }} {{- if ne .Key "0001" }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 5797a30..67e1897 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,6 +32,7 @@ {{- $pages := .Pages }} {{- if .IsHome }} + {{/* get all regular pages instead of pages in a section */}} {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections }} {{- end }} {{- $pages = where $pages "Params.hidden" "!=" true }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index 95bbf7d..a52e40f 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -13,12 +13,10 @@ {{- partial "newsletter_sub_form.html"}} - {{- $pages := where .Pages "Params.hidden" "!=" true }} -

最近更新

- {{- range first 5 $pages }} + {{- range first 5 (where .Pages "Params.hidden" "!=" true) }}
{{- if not .Date.IsZero -}} diff --git a/layouts/partials/post_nav_links.html b/layouts/partials/post_nav_links.html index 2d1eaa9..c52fbfa 100644 --- a/layouts/partials/post_nav_links.html +++ b/layouts/partials/post_nav_links.html @@ -1,4 +1,11 @@ -{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} +{{/* get pages from the current page's section */}} +{{- $sections := site.Params.mainSections }} +{{- if .Section }} + {{- $sections = slice .Section }} +{{- end }} +{{ $sections }} +{{- $pages := where (where site.RegularPages "Section" "in" $sections) "Params.hidden" "!=" true }} + {{- if and (gt (len $pages) 1) (in $pages . ) }}
{{- end }} - {{- with .Param "archivesSlug" }} -
- Archives + - {{- end }} {{- end }} diff --git a/layouts/newsletter/section.html b/layouts/newsletter/section.html index a52e40f..11d52ab 100644 --- a/layouts/newsletter/section.html +++ b/layouts/newsletter/section.html @@ -35,13 +35,13 @@

相关链接

-
+
-- cgit v1.2.3