commit 065928fcf017b0ce6977fef666f7977f7f09b4d7
parent 34ac562ce4544cb481d286e3aa040f5ca14afc04
Author: spf13 <steve.francia@gmail.com>
Date: Sat, 28 Dec 2013 12:56:12 -0500
Adding page sorting by weight function (the default)
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -121,6 +121,11 @@ func (p Pages) Limit(n int) Pages {
}
}
+func (p Pages) ByWeight() Pages {
+ PageBy(DefaultPageSort).Sort(p)
+ return p
+}
+
func (p Pages) ByDate() Pages {
date := func(p1, p2 *Page) bool {
return p1.Date.Unix() < p2.Date.Unix()