shithub: hugo

Download patch

ref: fd08e16ec8abb923a1ffe23a60b2aa8316151559
parent: beccdc04f31977adb973e4395429597afcd11aa3
author: Dana H. P'Simer <[email protected]>
date: Fri Apr 24 10:25:09 EDT 2015

Add RSSUri to specify the name of the RSS file

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -152,6 +152,7 @@
 	viper.SetDefault("Paginate", 10)
 	viper.SetDefault("PaginatePath", "page")
 	viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
+	viper.SetDefault("RSSUri", "index.xml")
 
 	if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
 		viper.Set("BuildDrafts", Draft)
--- a/hugolib/rss_test.go
+++ b/hugolib/rss_test.go
@@ -34,6 +34,7 @@
 
 func TestRSSOutput(t *testing.T) {
 	viper.Set("baseurl", "http://auth/bub/")
+	viper.Set("RSSUri", "index.xml")
 
 	hugofs.DestinationFS = new(afero.MemMapFs)
 	s := &Site{
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1251,7 +1251,7 @@
 
 	if !viper.GetBool("DisableRSS") {
 		// XML Feed
-		n.URL = s.permalinkStr("index.xml")
+		n.URL = s.permalinkStr(viper.GetString("RSSUri"))
 		n.Title = ""
 		high := 50
 		if len(s.Pages) < high {
@@ -1264,7 +1264,7 @@
 
 		rssLayouts := []string{"rss.xml", "_default/rss.xml", "_internal/_default/rss.xml"}
 
-		if err := s.renderAndWriteXML("homepage rss", "index.xml", n, s.appendThemeTemplates(rssLayouts)...); err != nil {
+		if err := s.renderAndWriteXML("homepage rss", viper.GetString("RSSUri"), n, s.appendThemeTemplates(rssLayouts)...); err != nil {
 			return err
 		}
 	}