mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Add RSSUri to specify the name of the RSS file
This commit is contained in:
parent
beccdc04f3
commit
fd08e16ec8
3 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue