I been using this approach
To exclude files from Sitemap.
I got my internal method to exclude some files from RSS template but as the above is neat, I want to simplify my code instead of ranging and excluding by if
.
The problem I am facing is that this:
{{- range where $pages "Sitemap.Disable" "ne" true }}
with this in front matter:
---
sitemap:
disable: true
---
Working well. This is used in my sitemap file with
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
on front and later
{{ range where $pages "Sitemap.Disable" "ne" true }}
But, if I want to implement same approach in my rss.xml
file, this do not work:
{{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
{{- $pages := slice }}
{{- if or $.IsHome $.IsSection }}
{{- $pages = $pctx.RegularPages }}
{{- else }}
{{- $pages = $pctx.Pages }}
{{- end }}
{{- $limit := .Site.Config.Services.RSS.Limit }}
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
later
{{ range where $pages "Rss.Disable" "ne" true }}
and in front matter
---
rss:
disable: true
---
Interesting is if I put this:
{{ range where $pages "Sitemap.Disable" "ne" true }}
and update frontmatter, it working.
Is there a parameter RSS in collision with some internal templating and this is the reason why is not working?