aboutsummaryrefslogtreecommitdiffstats
path: root/archive
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2017-12-17 10:52:09 -0800
committerAdam Mathes <adam@trenchant.org>2017-12-17 10:52:09 -0800
commit24fdaa7a398c1ec20c8b02e51ef362248c3adf4e (patch)
treeb1a9e5d19b123a36301d026961c828a59d4e2374 /archive
parent6e33ee7e84d98eed6201a578d965565fb67a9776 (diff)
downloadsnkt-24fdaa7a398c1ec20c8b02e51ef362248c3adf4e.tar.gz
snkt-24fdaa7a398c1ec20c8b02e51ef362248c3adf4e.tar.bz2
snkt-24fdaa7a398c1ec20c8b02e51ef362248c3adf4e.zip
tag sort stuff
Diffstat (limited to 'archive')
-rw-r--r--archive/tag.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/archive/tag.go b/archive/tag.go
index 3554d9c..ff10fba 100644
--- a/archive/tag.go
+++ b/archive/tag.go
@@ -6,6 +6,7 @@ import (
"adammathes.com/snkt/render"
"fmt"
"path"
+ "sort"
)
var tagTmplName = "tag"
@@ -30,6 +31,18 @@ func (ta TagArchive) Target() string {
type TagArchives []*TagArchive
+func (tags TagArchives) Len() int {
+ return len(tags)
+}
+
+func (tags TagArchives) Less(i, j int) bool {
+ return tags[i].Tag < tags[j].Tag
+}
+
+func (tags TagArchives) Swap(i, j int) {
+ tags[i], tags[j] = tags[j], tags[i]
+}
+
func ParseTags(posts post.Posts) *TagArchives {
if !render.TmplExists(tagTmplName) {
@@ -61,6 +74,7 @@ func ParseTags(posts post.Posts) *TagArchives {
tas = append(tas, &ta)
}
+ sort.Sort(tas)
return &tas
}