tpl: Fix RSS template for the terms listing

Fixes #6909
This commit is contained in:
Bjørn Erik Pedersen 2020-02-18 16:55:30 +01:00
parent 1b7acfe763
commit aa3e183056
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
3 changed files with 13 additions and 3 deletions

View file

@ -561,6 +561,6 @@ categories: ["funny"]
b.Assert(funny.Parent(), qt.Equals, cat)
b.AssertFileContent("public/categories/funny/index.xml", `<link>http://example.com/p/</link>`)
// TODO https://github.com/gohugoio/hugo/issues/6909 b.AssertFileContent("public/categories/index.xml", `<link>http://example.com/categories/funny/</link>`)
b.AssertFileContent("public/categories/index.xml", `<link>http://example.com/categories/funny/</link>`)
}

View file

@ -21,7 +21,12 @@ var EmbeddedTemplates = [][2]string{
{`_default/robots.txt`, `User-agent: *`},
{`_default/rss.xml`, `{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}}
{{- $pages := slice -}}
{{- if eq $.Kind "taxonomyTerm" -}}
{{- $pages = $pctx.Pages -}}
{{- else -}}
{{- $pages = $pctx.RegularPages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}

View file

@ -1,6 +1,11 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}}
{{- $pages := slice -}}
{{- if eq $.Kind "taxonomyTerm" -}}
{{- $pages = $pctx.Pages -}}
{{- else -}}
{{- $pages = $pctx.RegularPages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}