package pages import ( "embed" "html/template" "net/http" ) //go:embed templates/* var content embed.FS func InitHttpHandlers() { http.HandleFunc("/{$}", homepage) http.HandleFunc("/.well-known/autoconfig/mail/config-v1.1.xml", emailAutoconfig) http.HandleFunc("/mail/config-v1.1.xml", emailAutoconfig) } func homepage(w http.ResponseWriter, r *http.Request) { templateFile := "templates/homepage.tmpl" files, err := template.New(templateFile).ParseFS(content, templateFile) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } err = files.ExecuteTemplate(w, "homepage.tmpl", nil) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } }