cheeky bit cheaper

This commit is contained in:
tobi 2025-02-20 14:53:17 +01:00
commit 46eeef9df8
2 changed files with 7 additions and 5 deletions

View file

@ -240,10 +240,12 @@ func templatePage(
// Render given template inside the page. // Render given template inside the page.
obj["pageContent"] = template obj["pageContent"] = template
// Inject specific page class by replacing // Inject specific page class by trimming
// ".tmpl" with "-page", so "index.tmpl" for // ".tmpl" suffix. In the page template
// example gets class "page index-page". // (see page.tmpl) this will be appended
obj["pageClass"] = template[0:len(template)-5] + "-page" // 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) c.HTML(code, pageTmpl, obj)
} }

View file

@ -71,7 +71,7 @@ image/webp
{{- end }} {{- end }}
<title>{{- template "instanceTitle" . -}}</title> <title>{{- template "instanceTitle" . -}}</title>
</head> </head>
<body class="page{{- if .pageClass }} {{ .pageClass }}{{- end -}}"> <body class="page{{- if .pageClass }} {{ .pageClass }}-page{{- end -}}">
{{- include "login_button.tmpl" . | indent 3 }} {{- include "login_button.tmpl" . | indent 3 }}
<header class="page-header"> <header class="page-header">
{{- include "page_header.tmpl" . | indent 3 }} {{- include "page_header.tmpl" . | indent 3 }}