shithub: hugo

Download patch

ref: b15eb889e8c05885d6a58dc4f49eb5005e8b9c0b
parent: 41b28462e8f427a6a2a9e4efa81a48eee7e0124b
author: spf13 <[email protected]>
date: Fri Aug 29 19:50:25 EDT 2014

Adding .Reverse() to PagesGroup

--- a/hugolib/pageGroup.go
+++ b/hugolib/pageGroup.go
@@ -17,6 +17,7 @@
 	"errors"
 	"reflect"
 	"sort"
+	"strings"
 )
 
 type PageGroup struct {
@@ -62,6 +63,16 @@
 }
 
 func (p Pages) GroupBy(key, order string) ([]PageGroup, error) {
+type PagesGroup []PageGroup
+
+func (p PagesGroup) Reverse() PagesGroup {
+	for i, j := 0, len(p)-1; i < j; i, j = i+1, j-1 {
+		p[i], p[j] = p[j], p[i]
+	}
+
+	return p
+}
+
 	if len(p) < 1 {
 		return nil, nil
 	}