Templated RSS feature to include special postroll rules

This commit is contained in:
Brandon Rozek 2026-04-26 20:50:10 -04:00
parent 6f8ae91e56
commit 47c3dcfc5d
3 changed files with 18 additions and 63 deletions

View file

@ -29,18 +29,12 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Params.email }}<author>{{.}}{{ with $.Site.Params.Author }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
{{ printf `<description><![CDATA[%s]]></description>` .Summary | safeHTML }}
{{ printf `<content:encoded><![CDATA[%s]]></content:encoded>` .Content | safeHTML }}
{{ range .Param "tags" }}<category>{{ . }}</category>
{{ end }}
</item>
{{ end }}
{{ range $pages }}
{{ $itemPartial := printf "rss-item/%s.xml" .Type }}
{{- if not (templates.Exists (printf "partials/%s" $itemPartial)) -}}
{{- $itemPartial = "rss-item/default.xml" -}}
{{- end -}}
{{ partial $itemPartial . }}
{{ end }}
</channel>
</rss>