Refine rss build logic (#545)

* Add refine rss build logic

* Switch to .RelPermalink since URL is deprecated
This commit is contained in:
James Ray 2022-02-28 23:10:10 -05:00 committed by GitHub
parent 711d4c7749
commit e151dad461
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,12 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- if $.IsHome -}}
{{- $pages = $pctx.RegularPages -}}
{{- else if $.IsSection -}}
{{- $pages = $pctx.RegularPagesRecursive -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- $pages = $pctx.RegularPagesRecursive -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
@ -26,7 +28,7 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
{{- if ne .URL "search" -}}
{{- if ne .RelPermalink "/search/" -}}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>