From cb0405338568055fcfe3440ad539c5d3aebc6486 Mon Sep 17 00:00:00 2001 From: spf13 Date: Sat, 18 Jan 2014 11:02:27 -0500 Subject: [PATCH] RSS improvements, now limit to 15 items and provide accurate date. fixed #172 --- hugolib/site.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hugolib/site.go b/hugolib/site.go index 3fd5b3d58..313537f80 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -519,6 +519,14 @@ func (s *Site) RenderHomePage() error { n.Url = helpers.Urlize("index.xml") n.Title = "Recent Content" 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") if err != nil { return err