This commit is contained in:
bronku 2026-06-10 22:14:48 +02:00
parent 7c756e87c1
commit d69d8c3857
24 changed files with 3421 additions and 859 deletions

View file

@ -14,8 +14,12 @@ var templates embed.FS
func (h *Server) loadTemplates() {
h.tmpl = make(map[string]*template.Template)
funcs := template.FuncMap{
"add": func(a, b int) int { return a + b },
"mult": func(a, b int) int { return a * b },
}
for _, page := range h.routes {
tmpl, err := template.ParseFS(templates,
tmpl, err := template.New("").Funcs(funcs).ParseFS(templates,
"templates/layout/*.gohtml",
"templates/"+page.template+".gohtml",
)