diff options
author | reuixiy <reuixiy@gmail.com> | 2021-10-08 18:36:05 +0300 |
---|---|---|
committer | reuixiy <reuixiy@gmail.com> | 2021-10-08 18:36:05 +0300 |
commit | 7cf157797f6857e99ef8b653f11d08ae2210d9bb (patch) | |
tree | f364ff92a9259f644228a29aac01742211ee7cc5 | |
parent | 8112664a053ccb93d454540615ddbe37a420d186 (diff) |
fix: filter pages before limit
-rw-r--r-- | layouts/index.sectionsatom.xml | 6 | ||||
-rw-r--r-- | layouts/index.sectionsrss.xml | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/layouts/index.sectionsatom.xml b/layouts/index.sectionsatom.xml index ca82dc3..e9a5a7e 100644 --- a/layouts/index.sectionsatom.xml +++ b/layouts/index.sectionsatom.xml @@ -2,10 +2,10 @@ <!-- Reference: https://tools.ietf.org/html/rfc4287 --> <!-- Reference: https://github.com/kaushalmodi/hugo-atom-feed/blob/master/layouts/_default/list.atom.xml --> <!-- Reference: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml --> -{{- $pages := .Site.RegularPages -}} +{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} + {{- $pages = $pages | first $limit -}} {{- end -}} <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ .Site.LanguageCode }}"> <title type="text">{{ .Site.Title }}</title> @@ -29,7 +29,7 @@ <rights>{{ . | plainify | htmlUnescape }}</rights> {{- end }} <generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator> - {{- range (where $pages "Section" "in" .Site.Params.mainSections) }} + {{- range $pages }} {{ $page := . }} {{- $author := partial "utils/author.html" $page -}} <entry> diff --git a/layouts/index.sectionsrss.xml b/layouts/index.sectionsrss.xml index 1d5a621..cf65b0c 100644 --- a/layouts/index.sectionsrss.xml +++ b/layouts/index.sectionsrss.xml @@ -1,14 +1,14 @@ -{{- `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }} +{{ `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }} <!-- Reference: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml --> <!-- Reference: https://github.com/kaushalmodi/hugo-atom-feed/blob/master/layouts/_default/list.atom.xml --> <!-- Reference: https://validator.w3.org/feed/docs/rss2.html --> <!-- Reference: https://developers.google.com/gdata/docs/1.0/reference --> <!-- Reference: https://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared --> <!-- Reference: https://en.wikipedia.org/wiki/RSS --> -{{- $pages := .Site.RegularPages -}} +{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections -}} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} + {{- $pages = $pages | first $limit -}} {{- end }} <rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> <channel> @@ -32,7 +32,7 @@ {{ with .OutputFormats.Get "SectionsRSS" }} <atom:link rel="self" type="{{ .MediaType }}" href="{{ .Permalink }}" /> {{ end }} - {{ range (where $pages "Section" "in" .Site.Params.mainSections) }} + {{ range $pages }} {{ $page := . }} {{- $author := partial "utils/author.html" $page -}} <item> |