much stuffs
This commit is contained in:
13
main.go
13
main.go
@@ -13,12 +13,13 @@ func pageHandler(w http.ResponseWriter, r *http.Request) {
|
||||
path = "/home"
|
||||
}
|
||||
|
||||
tmpl, err := template.ParseFiles(
|
||||
filepath.Join("templates/layout.html"),
|
||||
filepath.Join("templates/header.html"),
|
||||
filepath.Join("templates/footer.html"),
|
||||
filepath.Join("pages/"+path+".html"),
|
||||
)
|
||||
tmpl, err := template.Must(template.ParseGlob("templates/*.html")).Clone()
|
||||
if err != nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = tmpl.ParseFiles(filepath.Join("pages", path+".html"))
|
||||
if err != nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user