summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-02-20 15:09:28 +0100
committerLibravatar GitHub <noreply@github.com>2025-02-20 15:09:28 +0100
commit8829ee187afd24d0b54f12c73a3b9df1f8612f68 (patch)
tree9aa807a5a301b420a0a65531b2a9c8bc08ce0187 /internal/api
parent[bugfix] update fedi api to support multiple separate votes in same multiple ... (diff)
downloadgotosocial-8829ee187afd24d0b54f12c73a3b9df1f8612f68.tar.xz
[feature] Add page-specific class per template (#3814)v0.18.0-rc3
* [feature] Add page-specific class per template * cheeky bit cheaper
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/util/template.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/api/util/template.go b/internal/api/util/template.go
index 990874028..ec04a4d97 100644
--- a/internal/api/util/template.go
+++ b/internal/api/util/template.go
@@ -236,6 +236,16 @@ func templatePage(
obj map[string]any,
) {
const pageTmpl = "page.tmpl"
+
+ // Render given template inside the page.
obj["pageContent"] = template
+
+ // Inject specific page class by trimming
+ // ".tmpl" suffix. In the page template
+ // (see page.tmpl) this will be appended
+ // with "-page", so "index.tmpl" for example
+ // ends up with class "page index-page".
+ obj["pageClass"] = template[:len(template)-5]
+
c.HTML(code, pageTmpl, obj)
}