aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archive/tag.go14
-rw-r--r--site/site.go4
2 files changed, 16 insertions, 2 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
}
diff --git a/site/site.go b/site/site.go
index 8020c87..136c100 100644
--- a/site/site.go
+++ b/site/site.go
@@ -36,12 +36,12 @@ func (s *Site) Read() {
if render.TmplExists("archive") {
s.Archive = archive.NewListArchive(s.Posts)
- s.Archive.Site = *s
+ s.Archive.Site = s
sort.Sort(sort.Reverse(s.Archive.Posts))
}
if render.TmplExists("rss") {
s.Rss = archive.NewRssArchive(s.Posts)
- s.Rss.Site = *s
+ s.Rss.Site = s
}
if render.TmplExists("paged") {
s.Paged = archive.CreatePaged(15, s.Posts)