diff options
author | Nate Finch <nate.finch@gmail.com> | 2014-09-09 05:59:47 -0400 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-09-09 09:22:16 -0400 |
commit | 0099b5a3cb922ac3f844b5d9d9f098cd1003b0f5 (patch) | |
tree | 29502c0f6e321a8a7d21f7470a597270f402a8b8 /hugolib/pageSort.go | |
parent | d9964451a570aec28116f9f0a35d54a2a42fc6ce (diff) |
Change all uses of sort.Sort to sort.Stable.Using sort.Stable ensures that even if the sort keys are the same, the order of the sort will not randomly change. Using the old sort.Sort, if you had pages with no date, the lists of those pages would randomly reorder every time you regenerate the list, causing spurious changes to the output. Now they'll always get ordered in the same way.
Diffstat (limited to 'hugolib/pageSort.go')
-rw-r--r-- | hugolib/pageSort.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hugolib/pageSort.go b/hugolib/pageSort.go index 63e230ac0..c621740b2 100644 --- a/hugolib/pageSort.go +++ b/hugolib/pageSort.go @@ -35,7 +35,7 @@ func (by PageBy) Sort(pages Pages) { pages: pages, by: by, // The Sort method's receiver is the function (closure) that defines the sort order. } - sort.Sort(ps) + sort.Stable(ps) } var DefaultPageSort = func(p1, p2 *Page) bool { |