Added a page-specific CSS class on <body>
This commit is contained in:
@@ -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 <body>
|
||||
"Name": strings.TrimSuffix(name, ".html"),
|
||||
}
|
||||
newData["Config"] = config.Object()
|
||||
|
||||
return tmpl.ExecuteTemplate(w, "base", newData)
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@
|
||||
<link rel="stylesheet" href="/assets/theme-dark.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body {{ if .Page.Name }}class="page-{{ .Page.Name }}"{{ end }}>
|
||||
<nav>
|
||||
<!-- Site -->
|
||||
<div class="nav-logo">
|
||||
|
||||
Reference in New Issue
Block a user