mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Adding page sorting by weight function (the default)
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user