diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index c6bc3e4..e477612 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -1,5 +1,11 @@ -{{ $list := .Pages -}} -{{ $length := (len $list) -}} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := $pctx.RegularPages -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{ $length := (len $pages) -}} { "version" : "https://jsonfeed.org/version/1", "title" : "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}", @@ -22,7 +28,7 @@ }, {{ end -}} "items" : [ - {{ range $index, $element := $list -}} + {{ range $index, $element := $pages -}} { "title" : {{ .Title | jsonify }}, "date_published" : "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}", diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index e41afbf..c4f6695 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/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 "" | safeHTML }} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }} @@ -22,7 +30,7 @@ {{ with .OutputFormats.Get "RSS" -}} {{ printf "" .Permalink .MediaType | safeHTML }} {{ end -}} - {{ range .Pages }} + {{ range $pages }} {{ .Title }} {{ .Permalink }}