fix(RSS): page context selection

This commit is contained in:
Allen Guan 2022-03-03 12:38:47 +08:00
parent 24cd07589b
commit 9dbc0a4f38
No known key found for this signature in database
GPG key ID: 2FBBBC14D758CF31

View file

@ -1,5 +1,13 @@
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} {{- $pctx := . -}}
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}} {{- 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) -}} {{- $filtered := ($pages | intersect $notHidden) -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}