shithub: hugo

Download patch

ref: aa3e1830568cabaa8bf3277feeba6cb48746e40c
parent: 1b7acfe7634a5d7bbc597ef4dddf4babce5666c5
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Tue Feb 18 11:55:30 EST 2020

tpl: Fix RSS template for the terms listing

Fixes #6909

--- a/hugolib/taxonomy_test.go
+++ b/hugolib/taxonomy_test.go
@@ -561,6 +561,6 @@
 	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>`)
 
 }
--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -21,7 +21,12 @@
 	{`_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 -}}
--- a/tpl/tplimpl/embedded/templates/_default/rss.xml
+++ b/tpl/tplimpl/embedded/templates/_default/rss.xml
@@ -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 -}}