1
Fork 0

Override builtin RSS template to cleanup and add encoded content

This commit is contained in:
Jake Howard 2018-05-11 09:34:34 +01:00
parent ef6c17f3c0
commit 0a328b0ca2
Signed by: jake
GPG key ID: 57AFB45680EDD477

27
layouts/_default/rss.xml Normal file
View file

@ -0,0 +1,27 @@
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content in {{ .Title }}</description>
<generator>Hugo -- gohugo.io</generator>
<language>{{ .Site.LanguageCode }}</language>
<copyright>{{ partial "copyright.html" . | html }}</copyright>
<managingEditor>{{ .Site.Params.author }}</managingEditor>
<webMaster>{{ .Site.Params.author }}</webMaster>
<lastBuildDate>{{ now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range .Data.Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<atom:updated>{{ .Date.Format .Site.Params.iso8601 }}</atom:updated>
<content:encoded>{{ printf "<![CDATA[%s]]>" (replace .Content "\n" "") | safeHTML }}</content:encoded>
</item>
{{ end }}
</channel>
</rss>