diff --git a/main.go b/main.go index 37b47f8..12cb4e6 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,18 @@ func homeHandler(w http.ResponseWriter, r *http.Request) { } func contactHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf8") - fmt.Fprint(w, "
To get in touch, email me at example@example.com
") + tpl, err := template.ParseFiles("templates/contact.gohtml") + if err != nil { + log.Printf("Error parsing template: %v", err) + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } + err = tpl.Execute(w, nil) + if err != nil { + log.Printf("Error executing template: %v", err) + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } } func faqHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf8") diff --git a/templates/contact.gohtml b/templates/contact.gohtml new file mode 100644 index 0000000..1919ba3 --- /dev/null +++ b/templates/contact.gohtml @@ -0,0 +1,6 @@ +No.
+No.