mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Add page-specific class per template (#3814)
* [feature] Add page-specific class per template * cheeky bit cheaper
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user