Moved regio43 to base HTML template

This commit is contained in:
2025-05-23 18:30:08 +02:00
parent 847fb6491d
commit 54986f6edf
6 changed files with 38 additions and 46 deletions

View File

@@ -1,6 +1,21 @@
package baseTemplates
import "embed"
import (
"embed"
"html/template"
"net/http"
)
//go:embed templates/*
var FS embed.FS
func WithBase(w http.ResponseWriter, templateData any, patterns ...string) {
args := append([]string{"templates/base.tmpl"}, patterns...)
tmpl := template.Must(template.ParseFS(FS, args...))
err := tmpl.ExecuteTemplate(w, "base", templateData)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}