Add RSSUri to specify the name of the RSS file

This commit is contained in:
Dana H. P'Simer 2015-04-24 14:25:09 -04:00 committed by bep
parent beccdc04f3
commit fd08e16ec8
3 changed files with 4 additions and 2 deletions

View File

@ -152,6 +152,7 @@ func InitializeConfig() {
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)

View File

@ -34,6 +34,7 @@ const RSS_TEMPLATE = `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom
func TestRSSOutput(t *testing.T) {
viper.Set("baseurl", "http://auth/bub/")
viper.Set("RSSUri", "index.xml")
hugofs.DestinationFS = new(afero.MemMapFs)
s := &Site{

View File

@ -1251,7 +1251,7 @@ func (s *Site) RenderHomePage() error {
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 @@ func (s *Site) RenderHomePage() error {
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
}
}