summaryrefslogtreecommitdiffstats
path: root/hugolib/pageSort.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-21 14:23:00 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-21 14:23:00 +0200
commit2e2e34a9350edec0220462aa3d47ecc9d428a0fb (patch)
treed72c0e66d373be604342aff2ccc0100ca6fb8bee /hugolib/pageSort.go
parent2eed35c826e5de6aae432b36969a28c2ae3e0f02 (diff)
hugolib: Deprecate Pages.Sort
In favour of ByWeight.
Diffstat (limited to 'hugolib/pageSort.go')
-rw-r--r--hugolib/pageSort.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/hugolib/pageSort.go b/hugolib/pageSort.go
index dfd17b2b0..92b767ffe 100644
--- a/hugolib/pageSort.go
+++ b/hugolib/pageSort.go
@@ -1,4 +1,4 @@
-// Copyright 2015 The Hugo Authors. All rights reserved.
+// Copyright 2018 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,6 +14,8 @@
package hugolib
import (
+ "github.com/gohugoio/hugo/helpers"
+
"sort"
"github.com/spf13/cast"
@@ -98,6 +100,12 @@ func (ps *pageSorter) Less(i, j int) bool { return ps.by(ps.pages[i], ps.pages[j
// Sort sorts the pages by the default sort order defined:
// Order by Weight, Date, LinkTitle and then full file path.
func (p Pages) Sort() {
+ // Remove in Hugo 0.51
+ helpers.Deprecated("Pages", "Sort", "Use .ByWeight", false)
+ p.sort()
+}
+
+func (p Pages) sort() {
pageBy(defaultPageSort).Sort(p)
}