summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl/embedded/templates/_default/rss.xml
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/tplimpl/embedded/templates/_default/rss.xml')
-rw-r--r--tpl/tplimpl/embedded/templates/_default/rss.xml8
1 files changed, 7 insertions, 1 deletions
diff --git a/tpl/tplimpl/embedded/templates/_default/rss.xml b/tpl/tplimpl/embedded/templates/_default/rss.xml
index abba0b28a..675ecd43c 100644
--- a/tpl/tplimpl/embedded/templates/_default/rss.xml
+++ b/tpl/tplimpl/embedded/templates/_default/rss.xml
@@ -1,3 +1,9 @@
+{{- $pages := .Data.Pages -}}
+{{- $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>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
@@ -12,7 +18,7 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
- {{ range .Data.Pages }}
+ {{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>