mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
RSS improvements, now limit to 15 items and provide accurate date. fixed #172
This commit is contained in:
parent
303be735fb
commit
cb04053385
1 changed files with 8 additions and 0 deletions
|
@ -519,6 +519,14 @@ func (s *Site) RenderHomePage() error {
|
||||||
n.Url = helpers.Urlize("index.xml")
|
n.Url = helpers.Urlize("index.xml")
|
||||||
n.Title = "Recent Content"
|
n.Title = "Recent Content"
|
||||||
n.Permalink = permalink(s, "index.xml")
|
n.Permalink = permalink(s, "index.xml")
|
||||||
|
high := 15
|
||||||
|
if len(s.Pages) < high {
|
||||||
|
high = len(s.Pages)
|
||||||
|
}
|
||||||
|
n.Data["Pages"] = s.Pages[:high]
|
||||||
|
if len(s.Pages) > 0 {
|
||||||
|
n.Date = s.Pages[0].Date
|
||||||
|
}
|
||||||
err := s.render(n, ".xml", "rss.xml")
|
err := s.render(n, ".xml", "rss.xml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue