diff options
author | Nate Finch <nate.finch@gmail.com> | 2014-09-10 15:33:49 -0400 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-09-11 17:23:01 -0400 |
commit | 7142374332605a0d873bbab302767f3f154ec44c (patch) | |
tree | 03790bb102f266c92e326a116ad8454ef40c11ad /hugolib/taxonomy.go | |
parent | 275e1c0d234135a9938ecfc5b2fab861fc5170df (diff) |
Sort by title if dates are the same
Diffstat (limited to 'hugolib/taxonomy.go')
-rw-r--r-- | hugolib/taxonomy.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/hugolib/taxonomy.go b/hugolib/taxonomy.go index c03061830..93bd78f68 100644 --- a/hugolib/taxonomy.go +++ b/hugolib/taxonomy.go @@ -166,10 +166,12 @@ func (p WeightedPages) Sort() { sort.Stable(p) } func (p WeightedPages) Count() int { return len(p) } func (p WeightedPages) Less(i, j int) bool { if p[i].Weight == p[j].Weight { - return p[i].Page.Date.Unix() > p[j].Page.Date.Unix() - } else { - return p[i].Weight < p[j].Weight + if p[i].Page.Date.Equal(p[j].Page.Date) { + return p[i].Page.Title < p[j].Page.Title + } + return p[i].Page.Date.After(p[i].Page.Date) } + return p[i].Weight < p[j].Weight } // TODO mimic PagesSorter for WeightedPages |