package templ import ( "html/template" "net/http" "os" "path/filepath" "forgejo.gwairfelin.com/max/gonotes/internal/conf" ) type Ctx map[string]any func RenderTemplate(w http.ResponseWriter, tmpl string, context any) error { files := []string{ filepath.Join(conf.Conf.Templates.Dir, conf.Conf.Templates.Base), filepath.Join(conf.Conf.Templates.Dir, tmpl), } for _, f := range files { _, err := os.Stat(f) if err != nil { return err } } t, err := template.ParseFiles(files...) t.ExecuteTemplate(w, "base", context) return err }