shithub: hugo

Download patch

ref: 1bce8a854bc157e20c156c57b85bbab999e2c539
parent: bbfebdea433f7b08dbd9d49c2df863c7a24b9665
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Aug 11 18:57:17 EDT 2016

Create a copy of the section node for RSS

So the Permalink gets correct when listing translations.

I have also checked the other relevant places to make sure we do not overwrite node values we need later.

Pointers can be tricky, but lesson learned is: A copy is cheap.

Updates #2309

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1855,9 +1855,11 @@
 		if !viper.GetBool("DisableRSS") && section != "" {
 			// XML Feed
 			rssuri := viper.GetString("RSSUri")
-			s.setURLs(n, section+"/"+rssuri)
+			c := *n
+			rssNode := &c
+			s.setURLs(rssNode, section+"/"+rssuri)
 			rssLayouts := []string{"section/" + section + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
-			if err := s.renderAndWriteXML("section "+section+" rss", n.addLangPathPrefix(section+"/"+rssuri), n, s.appendThemeTemplates(rssLayouts)...); err != nil {
+			if err := s.renderAndWriteXML("section "+section+" rss", rssNode.addLangPathPrefix(section+"/"+rssuri), rssNode, s.appendThemeTemplates(rssLayouts)...); err != nil {
 				return err
 			}
 		}