diff --git a/src/routes/example.go b/src/routes/example.go index af6ec1b..4ac2f69 100644 --- a/src/routes/example.go +++ b/src/routes/example.go @@ -7,17 +7,17 @@ import ( func ExampleHandler(w http.ResponseWriter, r *http.Request) { data := PageData{ - Title: "Example Page", - } - - tmpl, err := template.ParseFiles("web/views/#layout.html", "web/views/example.html") - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } + Title: "Example Page", + } - err = tmpl.ExecuteTemplate(w, "layout", data) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } -} \ No newline at end of file + tmpl, err := template.ParseFiles("web/views/#layout.html", "web/views/example.html", "web/views/#header.html", "web/views/#footer.html") + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + err = tmpl.ExecuteTemplate(w, "layout", data) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } +} diff --git a/web/views/example.html b/web/views/example.html index 04c6f10..1693dc2 100644 --- a/web/views/example.html +++ b/web/views/example.html @@ -1,17 +1,11 @@ {{define "view"}} -
-

- This is an additional example route -

-
-
-

Serve Static Files Like this Globe

+

Serve Static Files Like this Gopher

+ + alternate text
- - {{end}}