seperate footer into template
This commit is contained in:
parent
55c6a35042
commit
9f741eecbe
@ -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
|
||||
|
5
web/views/#footer.html
Normal file
5
web/views/#footer.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{define "footer"}}
|
||||
<footer>
|
||||
<p>© 2024 My Web App</p>
|
||||
</footer>
|
||||
{{end}}
|
@ -12,6 +12,7 @@
|
||||
<body class="text-center text-blue-300 bg-gray-800">
|
||||
{{template "header" .}}
|
||||
{{template "view" .}}
|
||||
{{template "footer" .}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
|
@ -14,8 +14,4 @@
|
||||
<a href="/example">Another Example Route can be found here</a>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© 2024 My Web App</p>
|
||||
</footer>
|
||||
{{end}}
|
||||
|
Loading…
Reference in New Issue
Block a user