[release-branch.go1.2] blog: Fix atom feed's `updated' time when there's only one article.

««« CL 18420044 / e145aeb0df07
blog: Fix atom feed's `updated' time when there's only one article.

When computing the time for the "updated" tag of the atom feed, the
current code checks if there is more than one article and if that is
not true, it sets the time to the zero time.Time. This means that
the feed also gets the zero time in this tag when there is exactly one
article.

This trivial patch fixes this so that when there is exactly one
article, the time is set to that article's time.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/18420044

»»»

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/23390043
This commit is contained in:
Andrew Gerrand 2013-11-08 13:47:24 +11:00
parent 4b93659ce3
commit 72b8aac9ec
1 changed files with 1 additions and 1 deletions

View File

@ -259,7 +259,7 @@ func (s *Server) loadDocs(root string) error {
// atomFeed field. // atomFeed field.
func (s *Server) renderAtomFeed() error { func (s *Server) renderAtomFeed() error {
var updated time.Time var updated time.Time
if len(s.docs) > 1 { if len(s.docs) > 0 {
updated = s.docs[0].Time updated = s.docs[0].Time
} }
feed := atom.Feed{ feed := atom.Feed{