mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Adding page sorting by weight function (the default)
This commit is contained in:
parent
34ac562ce4
commit
065928fcf0
1 changed files with 5 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue