diff options
-rw-r--r-- | layouts/rss.xml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/layouts/rss.xml b/layouts/rss.xml index 31ffbce..2d14f51 100644 --- a/layouts/rss.xml +++ b/layouts/rss.xml @@ -1,3 +1,11 @@ +{{- $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" xmlns:webfeeds="http://webfeeds.org/rss/1.0"> <channel> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> @@ -15,7 +23,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> |