diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-11-28 14:28:24 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-11-28 15:52:26 +0300 |
commit | a9a93d082d8640684b7fd0076c64ea808ea7f762 (patch) | |
tree | 05248da0a986aa8d1993f0443e081789786cb19c /hugolib/page.go | |
parent | b09a40333f382cc1034d2eda856230258ab6b8cc (diff) |
hugolib: Fall back to title in ByLinkTitle sort
Fixes #4953
Diffstat (limited to 'hugolib/page.go')
-rw-r--r-- | hugolib/page.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index c726394a2..f3e87be7d 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -18,6 +18,7 @@ import ( "context" "errors" "fmt" + "math/rand" "reflect" "github.com/gohugoio/hugo/common/maps" @@ -517,6 +518,14 @@ func (ps Pages) String() string { return fmt.Sprintf("Pages(%d)", len(ps)) } +// Used in tests. +func (ps Pages) shuffle() { + for i := range ps { + j := rand.Intn(i + 1) + ps[i], ps[j] = ps[j], ps[i] + } +} + func (ps Pages) findPagePosByFilename(filename string) int { for i, x := range ps { if x.Filename() == filename { |