Create a copy of the section node for RSS
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 11 Aug 2016 20:57:17 +0000 (22:57 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 6 Sep 2016 15:32:20 +0000 (18:32 +0300)
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

hugolib/site.go

index 94c9efab77312e3df8752903737c4dec40a52dee..aa89b6929e521afe2f44953f203539f414a58f1b 100644 (file)
@@ -1855,9 +1855,11 @@ func (s *Site) renderSectionLists(prepare bool) error {
                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
                        }
                }