Enha: index.html to template

This commit is contained in:
Grail Finder
2025-05-02 09:12:31 +03:00
parent acaf4af4ce
commit 0963be7d72
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,4 @@
{{define "main"}}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -26,3 +27,4 @@
</div> </div>
</body> </body>
</html> </html>
{{end}}

View File

@ -18,6 +18,10 @@ func HandlePing(w http.ResponseWriter, r *http.Request) {
} }
func HandleHome(w http.ResponseWriter, r *http.Request) { func HandleHome(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("components/index.html")) tmpl, err := template.ParseGlob("components/*.html")
tmpl.Execute(w, roundWords) if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "main", roundWords)
} }