Skip to content

Commit

Permalink
hugolib: Fix .Site.LastChange setting
Browse files Browse the repository at this point in the history
If weights are added to the content front matter, the default sort order
can't be relied upon to set `.Site.LastChange`.

Fixes gohugoio#2909
  • Loading branch information
moorereason committed Feb 18, 2017
1 parent ed847ed commit d382af7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hugolib/site.go
Expand Up @@ -1341,7 +1341,8 @@ func readCollator(s *Site, results <-chan HandledResult, errs chan<- error) {
func (s *Site) buildSiteMeta() (err error) {
defer s.timerStep("build Site meta")

if len(s.Pages) == 0 {
ln := len(s.Pages)
if ln == 0 {
return
}

Expand All @@ -1356,7 +1357,7 @@ func (s *Site) buildSiteMeta() (err error) {

s.assembleMenus()

s.Info.LastChange = s.Pages[0].Lastmod
s.Info.LastChange = s.Pages.ByLastmod()[ln-1].Lastmod

return
}
Expand Down

0 comments on commit d382af7

Please sign in to comment.