diff options
author | Shaform <shaform@gmail.com> | 2020-07-17 06:03:58 +0300 |
---|---|---|
committer | Shaform <shaform@gmail.com> | 2020-07-17 06:04:41 +0300 |
commit | e04e3e7bd1fd3c96aee8f2f03cbad7ccd6aaec0a (patch) | |
tree | f40084b07b27372b2153dbca8258b1a8dbc4f8bf | |
parent | bf22a75be5ed19017af844e75ac743e18b907fbc (diff) |
fix rss problem
-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> |