Moved regio43 to base HTML template
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user