diff options
| author | Reorx <novoreorx@gmail.com> | 2022-09-08 00:46:41 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-09-08 00:46:41 +0800 |
| commit | ea6560465bbf5a95f2b93b7a46672b611bd9578e (patch) | |
| tree | c524718056f3f4709e223439a49088b8c0bbe119 /layouts | |
| parent | a0225ef9dc7fe881d9897a74c7b653795898d493 (diff) | |
fix rss pages query
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/rss.xml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 5a6386f..f151df5 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,15 +1,15 @@ -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = site }}{{- end -}} -{{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = where $pctx.RegularPages "Type" "in" site.Params.mainSections }} -{{- else -}} -{{- $pages = $pctx.Pages -}} -{{- end -}} +{{- $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 -}} + {{- $limit := site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} + {{- 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/"> <channel> |
