From 9f741eecbe61ffc84141f2b3def7b9a0c035de9c Mon Sep 17 00:00:00 2001 From: X201 Date: Sun, 26 May 2024 21:42:53 -0400 Subject: [PATCH] seperate footer into template --- src/routes/root.go | 2 +- web/views/#footer.html | 5 +++++ web/views/#layout.html | 1 + web/views/index.html | 4 ---- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 web/views/#footer.html diff --git a/src/routes/root.go b/src/routes/root.go index 950afeb..ad7dd9b 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", "web/views/#header.html") + tmpl, err := template.ParseFiles("web/views/#layout.html", "web/views/index.html", "web/views/#header.html", "web/views/#footer.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/web/views/#footer.html b/web/views/#footer.html new file mode 100644 index 0000000..0a66b30 --- /dev/null +++ b/web/views/#footer.html @@ -0,0 +1,5 @@ +{{define "footer"}} + + {{end}} \ No newline at end of file diff --git a/web/views/#layout.html b/web/views/#layout.html index b1c5619..884f5d3 100644 --- a/web/views/#layout.html +++ b/web/views/#layout.html @@ -12,6 +12,7 @@ {{template "header" .}} {{template "view" .}} + {{template "footer" .}} {{end}} diff --git a/web/views/index.html b/web/views/index.html index 2b4eaf6..7d481d9 100644 --- a/web/views/index.html +++ b/web/views/index.html @@ -14,8 +14,4 @@ Another Example Route can be found here - - {{end}}