Adding page sorting by weight function (the default)

This commit is contained in:
spf13 committed 2013-12-28 12:56:12 -05:00
1 parent 34ac562ce4
commit 065928fcf0
1 file changed
+5
+5
View File
@@ -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()