mirror of
https://github.com/gohugoio/hugo.git
synced 2025-01-29 00:25:13 +00:00
Sort by title if dates are the same
This commit is contained in:
parent
275e1c0d23
commit
7142374332
1 changed files with 5 additions and 3 deletions
|
@ -166,10 +166,12 @@ func (p WeightedPages) Sort() { sort.Stable(p) }
|
||||||
func (p WeightedPages) Count() int { return len(p) }
|
func (p WeightedPages) Count() int { return len(p) }
|
||||||
func (p WeightedPages) Less(i, j int) bool {
|
func (p WeightedPages) Less(i, j int) bool {
|
||||||
if p[i].Weight == p[j].Weight {
|
if p[i].Weight == p[j].Weight {
|
||||||
return p[i].Page.Date.Unix() > p[j].Page.Date.Unix()
|
if p[i].Page.Date.Equal(p[j].Page.Date) {
|
||||||
} else {
|
return p[i].Page.Title < p[j].Page.Title
|
||||||
return p[i].Weight < p[j].Weight
|
|
||||||
}
|
}
|
||||||
|
return p[i].Page.Date.After(p[i].Page.Date)
|
||||||
|
}
|
||||||
|
return p[i].Weight < p[j].Weight
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO mimic PagesSorter for WeightedPages
|
// TODO mimic PagesSorter for WeightedPages
|
||||||
|
|
Loading…
Reference in a new issue