aboutsummaryrefslogtreecommitdiff
path: root/view.go
diff options
context:
space:
mode:
Diffstat (limited to 'view.go')
-rw-r--r--view.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/view.go b/view.go
index aae362e..3a1c47a 100644
--- a/view.go
+++ b/view.go
@@ -9,6 +9,8 @@ func init() {
http.HandleFunc("/view/", viewHandler)
}
+var viewtmpl = template.Must(template.ParseFiles("tmpl/root", "tmpl/view"))
+
func viewHandler(w http.ResponseWriter, r *http.Request) {
title := r.URL.Path[len("/view/"):]
p, err := loadPage(title)
@@ -16,5 +18,5 @@ func viewHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
return
}
- p.render(w, template.Must(template.ParseFiles("tmpl/root", "tmpl/view")))
+ p.render(w, viewtmpl)
}