diff options
author | Allen Guan <me@nella17.tw> | 2022-03-03 07:38:47 +0300 |
---|---|---|
committer | Allen Guan <me@nella17.tw> | 2022-03-03 07:38:47 +0300 |
commit | 9dbc0a4f38b7afc81925cd15006287deb2e6ca41 (patch) | |
tree | b335765c407fb1babcb1b615230dec582cd0dd25 | |
parent | 24cd07589b9dff17a8eb120a9ea21be2b3db68e8 (diff) |
fix(RSS): page context selection
-rw-r--r-- | layouts/_default/rss.xml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 178f997..4934bd0 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,5 +1,13 @@ -{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} -{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $pages := where $pages "Type" "in" .Site.Params.mainSections -}} +{{- $notHidden := where $pages "Params.hidden" "!=" true -}} {{- $filtered := ($pages | intersect $notHidden) -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} |