mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:22:24 -05:00
[feature] Add page-specific class per template (#3814)
* [feature] Add page-specific class per template * cheeky bit cheaper
This commit is contained in:
parent
a03a35a5d6
commit
8829ee187a
7 changed files with 14 additions and 6 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue