1{{- $pages := .RegularPages -}}
2{{- $pages = where $pages "Draft" false -}}
3{{- $pages = where $pages "Date" "<=" now -}}
4{{- $pages = where $pages "Params.rss" "!=" false -}}
5{{- $pages = sort $pages "Date" "desc" -}}
6{{- $pages = first 20 $pages -}}
7{{- $feed := .OutputFormats.Get "RSS" -}}
8{{- $description := .Description | default (printf "Latest posts from %s" site.Title) -}}
9{{- printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML -}}
10<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
11 <channel>
12 <title>{{ .Title }} | {{ site.Title }}</title>
13 <link>{{ .Permalink }}</link>
14 {{- with $feed }}
15 <atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
16 {{- end }}
17 <description>{{ $description | plainify }}</description>
18 <copyright>© {{ now.Year }} {{ site.Title }}. Licensed under {{ site.Params.license.name }} ({{ site.Params.license.url }}).</copyright>
19 <language>{{ site.Language.Locale }}</language>
20 <generator>Hugo {{ hugo.Version }}</generator>
21 <ttl>60</ttl>
22 {{- range $pages }}
23 <item>
24 <title>{{ .Title }}</title>
25 <link>{{ .Permalink }}</link>
26 <guid isPermaLink="true">{{ .Permalink }}</guid>
27 <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</pubDate>
28 {{- with .Description }}
29 <description>{{ . | transform.XMLEscape | safeHTML }}</description>
30 {{- end }}
31 {{- with .Params.tags }}
32 {{- range . }}
33 <category>{{ . }}</category>
34 {{- end }}
35 {{- end }}
36 </item>
37 {{- end }}
38 </channel>
39</rss>