diff options
author | Shaform <shaform@gmail.com> | 2020-07-17 06:12:08 +0300 |
---|---|---|
committer | Shaform <shaform@gmail.com> | 2020-07-17 06:12:08 +0300 |
commit | 34aadcf2c0f0a588bb47da9f9f05da1fdd6214bb (patch) | |
tree | 8a19292f1b163daf6c2c13e87faf92b7853ddb0e /layouts | |
parent | e04e3e7bd1fd3c96aee8f2f03cbad7ccd6aaec0a (diff) |
follow hugo's rss logic
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/rss.xml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/layouts/rss.xml b/layouts/rss.xml index 2d14f51..444a1ee 100644 --- a/layouts/rss.xml +++ b/layouts/rss.xml @@ -1,6 +1,11 @@ {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := $pctx.RegularPages -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} @@ -21,7 +26,7 @@ <copyright>{{.}}</copyright>{{end}}{{ 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 .MediaType | safeHTML }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ end }} {{ range $pages }} <item> |