Implement shared template layout system
This commit is contained in:
parent
3be7fb76e7
commit
08b669fd8f
9 changed files with 69 additions and 45 deletions
16
internal/server/templates/layout/layout.html
Normal file
16
internal/server/templates/layout/layout.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{{define "layout"}}
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{{template "title" .}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>{{template "title" .}}</h1>
|
||||
</header>
|
||||
<nav>{{template "nav" .}}</nav>
|
||||
{{template "main" .}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
6
internal/server/templates/layout/nav.html
Normal file
6
internal/server/templates/layout/nav.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{{define "nav"}}
|
||||
<a href="/orders">All orders</a>
|
||||
<a href="/order">New order</a>
|
||||
<a href="/cakes">All Cakes</a>
|
||||
<a href="/cake">New Cake</a>
|
||||
{{end}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue