diff --git a/main.go b/main.go index 4b71f57..49ba3a7 100644 --- a/main.go +++ b/main.go @@ -45,7 +45,7 @@ func main() { r.SetFuncMap(template.FuncMap{ "upper": strings.ToUpper, }) - r.LoadHTMLFiles("templates/index.tmpl") + r.LoadHTMLFiles("templates/index.tmpl", "templates/phrase.tmpl") r.StaticFile("/favicon.ico", "./assets/favicon.ico") r.StaticFile("/main.js", "./assets/main.js") r.StaticFile("/htmx.js", "./assets/htmx@1.9.10.min.js") @@ -96,7 +96,7 @@ func main() { } p.Source = s p.ID = id.Int64() - c.JSON(http.StatusOK, p) + c.HTML(http.StatusOK, "phrase.tmpl", p) }) r.Run() // 8080 diff --git a/templates/index.tmpl b/templates/index.tmpl index ff52c52..a9822b2 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -40,7 +40,23 @@ - + + +
+ + + + + + +
+
+ + + + + +
diff --git a/templates/phrase.tmpl b/templates/phrase.tmpl new file mode 100644 index 0000000..70e242c --- /dev/null +++ b/templates/phrase.tmpl @@ -0,0 +1 @@ +{{.Text}}