mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 23:12:10 -05:00
Allow to reverse taxonomy entries.
This commit is contained in:
parent
be3a3506c4
commit
d5c77bdf68
1 changed files with 8 additions and 0 deletions
|
@ -116,6 +116,14 @@ func (ie OrderedTaxonomyEntry) Term() string {
|
|||
return ie.Name
|
||||
}
|
||||
|
||||
func (t OrderedTaxonomy) Reverse() OrderedTaxonomy {
|
||||
for i, j := 0, len(t)-1; i < j; i, j = i+1, j-1 {
|
||||
t[i], t[j] = t[j], t[i]
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of a custom sorter for OrderedTaxonomies
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue