aboutsummaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-02-01 17:51:23 -0800
committerAdam Mathes <adam@trenchant.org>2018-02-01 17:51:23 -0800
commit1dc63a221695eeacf226e301ec4306e8573e1b79 (patch)
tree6b58ac6e5594679b6030f526df3ae8da590dd205 /site
parent64afdffb9ec3e9fd7de1c802775b895c7681fac2 (diff)
downloadsnkt-1dc63a221695eeacf226e301ec4306e8573e1b79.tar.gz
snkt-1dc63a221695eeacf226e301ec4306e8573e1b79.tar.bz2
snkt-1dc63a221695eeacf226e301ec4306e8573e1b79.zip
list generic templates
Diffstat (limited to 'site')
-rw-r--r--site/site.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/site/site.go b/site/site.go
index 136c100..b69a4af 100644
--- a/site/site.go
+++ b/site/site.go
@@ -10,6 +10,7 @@ import (
"log"
"path"
"sort"
+ "strings"
)
type Site struct {
@@ -19,11 +20,12 @@ type Site struct {
Posts post.Posts
// all archives are optional based on presence of template
- Archive *archive.ListArchive
- Home *archive.ListArchive
- Rss *archive.ListArchive
- Paged *archive.PagedArchives
- Tagged *archive.TagArchives
+ Archive *archive.ListArchive
+ Home *archive.ListArchive
+ Rss *archive.ListArchive
+ Paged *archive.PagedArchives
+ Tagged *archive.TagArchives
+ ListArchives []*archive.ListArchive
}
/*
@@ -55,6 +57,14 @@ func (s *Site) Read() {
s.Home.Template = "home"
s.Home.Site = s
}
+
+ // generic list templates
+ for _, t := range render.TemplateNames() {
+ if strings.HasSuffix(t, ".list") {
+ la := archive.NewGenericListArchive(s.Posts, t, strings.TrimSuffix(t, ".list"))
+ s.ListArchives = append(s.ListArchives, la)
+ }
+ }
}
/*
@@ -141,6 +151,11 @@ func (s *Site) WriteArchives() {
render.Write(t)
}
}
+ for _, t := range s.ListArchives {
+ t.Site = s
+ render.Write(t)
+ }
+
}
func (s *Site) WritePosts() {