aboutsummaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
Diffstat (limited to 'index.go')
-rw-r--r--index.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/index.go b/index.go
index 14f0ca9..10160ab 100644
--- a/index.go
+++ b/index.go
@@ -10,6 +10,8 @@ func init() {
http.HandleFunc("/index", indexHandler)
}
+var indextmpl = template.Must(template.ParseFiles("tmpl/root", "tmpl/index"))
+
func indexHandler(w http.ResponseWriter, r *http.Request) {
files, err := ioutil.ReadDir("data")
if err != nil {
@@ -23,5 +25,5 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
p.Pages = append(p.Pages, entry)
}
}
- p.render(w, template.Must(template.ParseFiles("tmpl/root", "tmpl/index")))
+ p.render(w, indextmpl)
}