mirror of
https://github.com/danog/gojekyll.git
synced 2024-12-12 20:37:21 +01:00
23 lines
492 B
Go
23 lines
492 B
Go
package collections
|
|
|
|
import "github.com/osteele/gojekyll/pages"
|
|
|
|
type pagesByDate struct{ pages []pages.Page }
|
|
|
|
// Len is part of sort.Interface.
|
|
func (p pagesByDate) Len() int {
|
|
return len(p.pages)
|
|
}
|
|
|
|
// Less is part of sort.Interface.
|
|
func (p pagesByDate) Less(i, j int) bool {
|
|
a, b := p.pages[i].PostDate(), p.pages[j].PostDate()
|
|
return a.Before(b)
|
|
}
|
|
|
|
// Swap is part of sort.Interface.
|
|
func (p pagesByDate) Swap(i, j int) {
|
|
pages := p.pages
|
|
pages[i], pages[j] = pages[j], pages[i]
|
|
}
|