From 1f099d4d53823136e3ac64fee0bcc9862f2cbdbf Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Sun, 19 Dec 2021 11:17:21 +0100 Subject: [PATCH 1/7] Added a page-specific CSS class on --- templates.go | 5 +++++ views/base.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/templates.go b/templates.go index de38e67..7d1a051 100644 --- a/templates.go +++ b/templates.go @@ -2,6 +2,7 @@ package main import ( "io" + "strings" "text/template" "github.com/phc-dm/server-poisson/config" @@ -41,6 +42,10 @@ func (t *TemplateRenderer) Render(w io.Writer, name string, data util.H) error { newData := util.H{} newData.Apply(data) + newData["Page"] = util.H{ + // Used to inject a page specific class on + "Name": strings.TrimSuffix(name, ".html"), + } newData["Config"] = config.Object() return tmpl.ExecuteTemplate(w, "base", newData) diff --git a/views/base.html b/views/base.html index 6bde1ec..cbabe30 100644 --- a/views/base.html +++ b/views/base.html @@ -61,7 +61,7 @@ - +