diff options
author | Adam Mathes <adam@trenchant.org> | 2018-02-01 17:51:23 -0800 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-02-01 17:51:23 -0800 |
commit | 1dc63a221695eeacf226e301ec4306e8573e1b79 (patch) | |
tree | 6b58ac6e5594679b6030f526df3ae8da590dd205 /archive | |
parent | 64afdffb9ec3e9fd7de1c802775b895c7681fac2 (diff) | |
download | snkt-1dc63a221695eeacf226e301ec4306e8573e1b79.tar.gz snkt-1dc63a221695eeacf226e301ec4306e8573e1b79.tar.bz2 snkt-1dc63a221695eeacf226e301ec4306e8573e1b79.zip |
list generic templates
Diffstat (limited to 'archive')
-rw-r--r-- | archive/archive.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/archive/archive.go b/archive/archive.go index 0a6e3c9..60fb89d 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -11,18 +11,18 @@ var archiveTmplName = "archive" var archiveName = "archive.html" /* -ListArchive +ListArchive */ type ListArchive struct { Posts post.Posts Tgt string Template string - + Site interface{} } func NewListArchive(posts post.Posts) *ListArchive { - la := ListArchive{ Posts: posts } + la := ListArchive{Posts: posts} return &la } @@ -40,12 +40,17 @@ func (a ListArchive) Render() []byte { return render.Render(a.Template, a) } - /* NewRssArchive takes posts and returns an archive ready for RSS output */ func NewRssArchive(posts post.Posts) *ListArchive { - ra := ListArchive{ Posts: posts, Template: "rss" } + ra := ListArchive{Posts: posts, Template: "rss"} ra.Tgt = path.Join(config.Config.HtmlDir, "rss.xml") return &ra } + +func NewGenericListArchive(posts post.Posts, templateName string, target string) *ListArchive { + la := ListArchive{Posts: posts, Template: templateName} + la.Tgt = path.Join(config.Config.HtmlDir, target) + return &la +} |