diff --git a/CHANGELOG.md b/CHANGELOG.md index 562c6f5..fa0cfe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to fingerprint them as well). - Enable placement of favicon into ``assets`` folder to enable fingerprinting as well. +- Updated feed template to honor the ``services.rss.limit`` setting. ### Changed - Updated ``rollup``, ``autoprefixer``, fonts and inner dependencies. @@ -31,6 +32,7 @@ and this project adheres to - Prevent adding the ``pure-table`` CSS class to tables containing code listings. This fixes broken display of code, and allows better output of line numbers alongside code samples. +- Generate feed from the proper input source to find all matching pages. ## [v0.2.2] diff --git a/_sites/changelog/config.yaml b/_sites/changelog/config.yaml index bb07203..685776e 100644 --- a/_sites/changelog/config.yaml +++ b/_sites/changelog/config.yaml @@ -84,6 +84,12 @@ author: # email: mail@example.org +services: + rss: + # limit the length of the rss feed (default: unlimited) + limit: 0 + + menu: footer: diff --git a/_sites/example/config.toml b/_sites/example/config.toml index 25edab3..ba6ba09 100644 --- a/_sites/example/config.toml +++ b/_sites/example/config.toml @@ -84,6 +84,11 @@ paginatePath = "page" email = "mail@example.org" +[services.rss] + # limit the length of the rss feed (default: unlimited) + limit = 0 + + [menu] # Configure main menu entries (header) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 86055a2..6fea3fe 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,3 +1,10 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} + {{- $pages := $pctx.RegularPages -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} + {{- $pages = $pages | first $limit -}} +{{- end -}} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }} @@ -20,7 +27,7 @@ {{- with .OutputFormats.Get "RSS" }} {{ printf "" .Permalink .MediaType | safeHTML }} {{- end }} - {{- range .Data.Pages }} + {{- range $pages }} {{ .Title }} {{ .Permalink }}