From 4bcba90a1a78cac4ec2ed370bb751d95717b7120 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 8 Feb 2024 15:53:08 +0000 Subject: First proper use of templates --- cmd/web/handlers.go | 2 +- ui/html/base.tmpl.html | 9 +++++++-- ui/html/pages/home.tmpl.html | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 ui/html/pages/home.tmpl.html diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index 7a8f79e..fd70c5e 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -31,7 +31,7 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) { files := []string{ "./ui/html/base.tmpl.html", - // "./ui/html/pages/home.tmpl.html", + "./ui/html/pages/home.tmpl.html", // "./ui/html/partials/nav.tmpl.html", } diff --git a/ui/html/base.tmpl.html b/ui/html/base.tmpl.html index 77ea1e9..f7f7e48 100644 --- a/ui/html/base.tmpl.html +++ b/ui/html/base.tmpl.html @@ -4,10 +4,15 @@ - DED + {{ template "title" .}} - DED -

Hello from DED!

+
+

DED

+
+
+ {{ template "main" }} +
{{ end }} diff --git a/ui/html/pages/home.tmpl.html b/ui/html/pages/home.tmpl.html new file mode 100644 index 0000000..882a3ba --- /dev/null +++ b/ui/html/pages/home.tmpl.html @@ -0,0 +1,6 @@ +{{define "title"}}Home{{end}} + +{{ define "main" }} +

Data

+

There is nothing to see here yet.

+{{ end }} -- cgit v1.2.3