fix rss pages query

This commit is contained in:
Reorx 2022-09-08 00:46:41 +08:00
parent a0225ef9dc
commit ea6560465b
1 changed files with 8 additions and 8 deletions

View File

@ -1,15 +1,15 @@
{{- $pctx := . -}} {{- $pages := .Pages -}}
{{- if .IsHome -}}{{ $pctx = site }}{{- end -}} {{- if $.IsHome -}}
{{- $pages := slice -}} {{/* get all regular pages instead of pages in a section */}}
{{- if or $.IsHome $.IsSection -}} {{- $pages = where site.RegularPages "Section" "in" site.Params.mainSections -}}
{{- $pages = where $pctx.RegularPages "Type" "in" site.Params.mainSections }} {{- end }}
{{- else -}} {{- $pages = where $pages "Params.hidden" "!=" true -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := site.Config.Services.RSS.Limit -}} {{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}
{{- end -}} {{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel> <channel>