Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <github@jimmycai.com>2022-03-05 20:13:42 +0300
committerGitHub <noreply@github.com>2022-03-05 20:13:42 +0300
commit72629cf476d939448010e789177a5f6796a2ad9f (patch)
tree931d61801cc848a6b3ebed9a42a20c36ddf018b9
parent5449f786ac52048800e5e47504b540498217d7fc (diff)
parentd455336d579da37139ef4efe3f9060871a62b94d (diff)
Merge branch 'fix-rss-pctx' of https://github.com/nella17/hugo-theme-stack into nella17-fix-rss-pctx
-rw-r--r--layouts/rss.xml16
1 files changed, 11 insertions, 5 deletions
diff --git a/layouts/rss.xml b/layouts/rss.xml
index 178f997..e9f3f1a 100644
--- a/layouts/rss.xml
+++ b/layouts/rss.xml
@@ -1,9 +1,15 @@
-{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
-{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
-{{- $filtered := ($pages | intersect $notHidden) -}}
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- end -}}
+{{- $pages := where $pages "Params.hidden" "!=" true -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
-{{- $filtered = $filtered | first $limit -}}
+{{- $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">
@@ -20,7 +26,7 @@
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
- {{ range $filtered }}
+ {{ range $pages }}
{{- $content := safeHTML (.Summary | html) -}}
{{- if .Site.Params.rssFullContent -}}
{{- $content = safeHTML (.Content | html) -}}