summaryrefslogtreecommitdiffstats
path: root/hugolib/page.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-11-28 12:28:24 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-11-28 13:52:26 +0100
commita9a93d082d8640684b7fd0076c64ea808ea7f762 (patch)
tree05248da0a986aa8d1993f0443e081789786cb19c /hugolib/page.go
parentb09a40333f382cc1034d2eda856230258ab6b8cc (diff)
hugolib: Fall back to title in ByLinkTitle sort
Fixes #4953
Diffstat (limited to 'hugolib/page.go')
-rw-r--r--hugolib/page.go9
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 {