t.Fatalf("Unable to RenderHomePage: %s", err)
}
- file, err := hugofs.DestinationFS.Open("rss.xml")
+ file, err := hugofs.DestinationFS.Open("index.xml")
if err != nil {
- t.Fatalf("Unable to locate: %s", "rss.xml")
+ t.Fatalf("Unable to locate: %s", "index.xml")
}
rss := helpers.ReaderToBytes(file)
if !viper.GetBool("DisableRSS") {
// XML Feed
- s.setUrls(n, base+".xml")
+ n.Url = s.permalinkStr(base + "/index.xml")
+ n.Permalink = s.permalink(base)
rssLayouts := []string{"taxonomy/" + t.singular + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
b, err := s.renderXML("taxonomy "+t.singular+" rss", n, s.appendThemeTemplates(rssLayouts)...)
if err != nil {
results <- err
continue
} else {
- err := s.WriteDestFile(base+".xml", b)
+ err := s.WriteDestFile(base+"/index.xml", b)
if err != nil {
results <- err
}
return err
}
- if !viper.GetBool("DisableRSS") {
+ if !viper.GetBool("DisableRSS") && section != "" {
// XML Feed
- fmt.Println("Section...")
+ n.Url = s.permalinkStr(section + "/index.xml")
+ n.Permalink = s.permalink(section)
rssLayouts := []string{"section/" + section + ".rss.xml", "_default/rss.xml", "rss.xml", "_internal/_default/rss.xml"}
- s.setUrls(n, section+".xml")
b, err = s.renderXML("section "+section+" rss", n, s.appendThemeTemplates(rssLayouts)...)
if err != nil {
return err
}
- if err := s.WriteDestFile(section+".xml", b); err != nil {
+ if err := s.WriteDestFile(section+"/index.xml", b); err != nil {
return err
}
}
if !viper.GetBool("DisableRSS") {
// XML Feed
- n.Url = helpers.Urlize("index.xml")
- n.Title = "Recent Content"
- n.Permalink = s.permalink("index.xml")
+ n.Url = s.permalinkStr("index.xml")
+ n.Title = ""
high := 50
if len(s.Pages) < high {
high = len(s.Pages)
n.Date = s.Pages[0].Date
}
- if !viper.GetBool("DisableRSS") {
- rssLayouts := []string{"rss.xml", "_default/rss.xml", "_internal/_default/rss.xml"}
- b, err := s.renderXML("homepage rss", n, s.appendThemeTemplates(rssLayouts)...)
- if err != nil {
- return err
- }
- if err := s.WriteDestFile("rss.xml", b); err != nil {
- return err
- }
+ rssLayouts := []string{"rss.xml", "_default/rss.xml", "_internal/_default/rss.xml"}
+ b, err := s.renderXML("homepage rss", n, s.appendThemeTemplates(rssLayouts)...)
+ if err != nil {
+ return err
+ }
+ if err := s.WriteDestFile("index.xml", b); err != nil {
+ return err
}
}
t.AddInternalTemplate("_default", "rss.xml", `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
- <title>{{ .Title }} on {{ .Site.Title }} </title>
- <generator uri="https://gohugo.io">Hugo</generator>
+ <title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
+ <description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description>
+ <generator>Hugo -- gohugo.io</generator>
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}
{{ with .Site.Author.name }}<author>{{.}}</author>{{end}}
{{ with .Site.Copyright }}<copyright>{{.}}</copyright>{{end}}
- <updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" }}</updated>
+ <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" }}</lastBuildDate>
+ <atom:link href="{{.Url}}" rel="self" type="application/rss+xml" />
{{ range first 15 .Data.Pages }}
<item>
<title>{{ .Title }}</title>