Compare commits
2 Commits
d7cb0d06f4
...
55c6a35042
Author | SHA1 | Date | |
---|---|---|---|
55c6a35042 | |||
157729db16 |
@ -14,7 +14,7 @@ func RootHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Title: "Home Page",
|
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 {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 612 KiB |
Binary file not shown.
Before Width: | Height: | Size: 44 KiB |
BIN
web/static/img/gopher.png
Normal file
BIN
web/static/img/gopher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 76 KiB |
7
web/views/#header.html
Normal file
7
web/views/#header.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{{define "header"}}
|
||||||
|
<header>
|
||||||
|
<h1 class="mt-8 mb-8 text-3xl font-bold text-blue-400">
|
||||||
|
Welcome to My GO Web App Framework {{.Title}}
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
{{end}}
|
@ -10,6 +10,7 @@
|
|||||||
<script src="/static/htmx.min.js"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="text-center text-blue-300 bg-gray-800">
|
<body class="text-center text-blue-300 bg-gray-800">
|
||||||
|
{{template "header" .}}
|
||||||
{{template "view" .}}
|
{{template "view" .}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<h1 class="font-bold">Serve Static Files Like this Globe</h1>
|
<h1 class="font-bold">Serve Static Files Like this Globe</h1>
|
||||||
<img src="/static/img/globe.png" alt="alternate text">
|
<img src="/static/img/gopher.png" alt="alternate text">
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
{{define "view"}}
|
{{define "view"}}
|
||||||
<header>
|
|
||||||
<h1 class="mt-8 mb-8 text-3xl font-bold text-blue-400">
|
|
||||||
Welcome to My GO Web App Framework {{.Title}}
|
|
||||||
</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<button hx-get="/api/example" class="p-2 text-white bg-blue-400 rounded-md">
|
<button hx-get="/api/example" class="p-2 text-white bg-blue-400 rounded-md">
|
||||||
|
Loading…
Reference in New Issue
Block a user