From 62a8b187e46bbb65a61aabf663da7bc7911a2f7f Mon Sep 17 00:00:00 2001 From: razonyang Date: Wed, 18 Jun 2025 11:23:38 +0800 Subject: [PATCH] feat: add the main_section page parameter for home and list page, which has higher priority than blog.home.main_sections --- layouts/_default/index.html | 2 +- layouts/partials/hb/modules/blog/index.html | 2 +- layouts/partials/hb/modules/blog/title.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/_default/index.html b/layouts/_default/index.html index ff64b1cf..c3e7f15c 100644 --- a/layouts/_default/index.html +++ b/layouts/_default/index.html @@ -1,6 +1,6 @@ {{- define "title" }} {{- $pages := site.RegularPages }} - {{- with site.Params.hb.blog.home.main_sections }} + {{- with (default site.Params.hb.blog.home.main_sections .Params.main_sections) }} {{- $pages = where $pages "Section" "in" . }} {{- end }} {{- $pinned := first 1 (where $pages ".Params.pinned" true) }} diff --git a/layouts/partials/hb/modules/blog/index.html b/layouts/partials/hb/modules/blog/index.html index f1f7aad6..7f2ef584 100644 --- a/layouts/partials/hb/modules/blog/index.html +++ b/layouts/partials/hb/modules/blog/index.html @@ -1,5 +1,5 @@ {{- $pages := site.RegularPages }} -{{- with site.Params.hb.blog.home.main_sections }} +{{- with (default site.Params.hb.blog.home.main_sections .Params.main_sections) }} {{- $pages = where $pages "Section" "in" . }} {{- end }} {{- $pinnedPos := default "" site.Params.hb.blog.home.pinned_posts_position }} diff --git a/layouts/partials/hb/modules/blog/title.html b/layouts/partials/hb/modules/blog/title.html index 0fb80730..1e91a654 100644 --- a/layouts/partials/hb/modules/blog/title.html +++ b/layouts/partials/hb/modules/blog/title.html @@ -1,5 +1,5 @@ {{- $pages := site.RegularPages }} -{{- with site.Params.hb.blog.home.main_sections }} +{{- with (default site.Params.hb.blog.home.main_sections .Params.main_sections) }} {{- $pages = where $pages "Section" "in" . }} {{- end }} {{- $paginator := .Paginate $pages site.Params.hb.blog.paginate }}