mirror of
https://github.com/gohugoio/hugo.git
synced 2024-07-04 16:21:57 +00:00
Adding page sorting by weight function (the default)
This commit is contained in:
parent
34ac562ce4
commit
065928fcf0
|
@ -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 {
|
func (p Pages) ByDate() Pages {
|
||||||
date := func(p1, p2 *Page) bool {
|
date := func(p1, p2 *Page) bool {
|
||||||
return p1.Date.Unix() < p2.Date.Unix()
|
return p1.Date.Unix() < p2.Date.Unix()
|
||||||
|
|
Loading…
Reference in a new issue