func editHandler(w http.ResponseWriter, r *http.Request, title string) { p, err := page.Load(pageSrcLocation, title) if err != nil { p = &page.Page{Title: title} } renderPageTemplate(w, "edit", p) }
func viewHandler(w http.ResponseWriter, r *http.Request, title string) { p, err := page.Load(pageLocation, title) if err != nil { http.Redirect(w, r, "/edit/"+title, http.StatusFound) return } renderPageTemplate(w, "view", p) }