mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Allow to reverse taxonomy entries.
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user