diff --git a/hugolib/taxonomy.go b/hugolib/taxonomy.go index 0602e03b4..1cab1a1eb 100644 --- a/hugolib/taxonomy.go +++ b/hugolib/taxonomy.go @@ -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 */