aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/rss.xml
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/_default/rss.xml')
-rw-r--r--themes/default/layouts/_default/rss.xml32
1 files changed, 32 insertions, 0 deletions
diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml
new file mode 100644
index 0000000..4570a98
--- /dev/null
+++ b/themes/default/layouts/_default/rss.xml
@@ -0,0 +1,32 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := $pctx.RegularPages -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <title>{{ partial "site-title" . }}</title>
+ <link>{{ .Permalink }}</link>
+ <description>Recent from {{ partial "site-title" . }}</description>
+ <language>{{ .Site.LanguageCode }}</language>
+ {{- if not .Date.IsZero -}}
+ <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
+ {{ with .OutputFormats.Get "RSS" }}
+ {{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink "application/rss+xml" | safeHTML -}}
+ {{ end }}
+ {{- range $pages -}}
+ {{ if and (ne .Params.hidden true) (not .Params.Unlisted) (not .ExpiryDate) }}
+ <item>
+ <title>{{ htmlEscape .Summary }}</title>
+ <link>{{ .Permalink }}</link>
+ <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+ <guid>{{ .Permalink }}</guid>
+ <description>{{ .Content | html }}</description>
+ </item>
+ {{ end }}
+ {{ end }}
+ </channel>
+</rss>