diff --git a/src/routes/root.go b/src/routes/root.go index 90205ff..950afeb 100644 --- a/src/routes/root.go +++ b/src/routes/root.go @@ -14,7 +14,7 @@ func RootHandler(w http.ResponseWriter, r *http.Request) { Title: "Home Page", } - tmpl, err := template.ParseFiles("web/views/#layout.html", "web/views/index.html") + tmpl, err := template.ParseFiles("web/views/#layout.html", "web/views/index.html", "web/views/#header.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/web/views/#header.html b/web/views/#header.html new file mode 100644 index 0000000..91b34c5 --- /dev/null +++ b/web/views/#header.html @@ -0,0 +1,7 @@ +{{define "header"}} +
+

+ Welcome to My GO Web App Framework {{.Title}} +

+
+ {{end}} \ No newline at end of file diff --git a/web/views/#layout.html b/web/views/#layout.html index 8490629..b1c5619 100644 --- a/web/views/#layout.html +++ b/web/views/#layout.html @@ -10,6 +10,7 @@ + {{template "header" .}} {{template "view" .}} diff --git a/web/views/index.html b/web/views/index.html index 94e4e0d..2b4eaf6 100644 --- a/web/views/index.html +++ b/web/views/index.html @@ -1,10 +1,4 @@ {{define "view"}} -
-

- Welcome to My GO Web App Framework {{.Title}} -

-
-