about summary refs log tree commit diff stats
path: root/internal/server/server.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-07 15:24:42 +0200
committerAlan Pearce2024-05-07 15:24:42 +0200
commit64520c95ef7ad3042049ad1bfcad7f72f1ae1325 (patch)
tree38d928963fe18d5f677b500290ae2055a58f4058 /internal/server/server.go
parente4fd32b04c1e3852bfd9a18e3afa5c1aea1ef9ea (diff)
downloadsearchix-64520c95ef7ad3042049ad1bfcad7f72f1ae1325.tar.lz
searchix-64520c95ef7ad3042049ad1bfcad7f72f1ae1325.tar.zst
searchix-64520c95ef7ad3042049ad1bfcad7f72f1ae1325.zip
refactor: rely on html/template functionality more
Diffstat (limited to 'internal/server/server.go')
-rw-r--r--internal/server/server.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index b6270ef..a6f22e2 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -107,7 +107,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 		LiveReload: jsSnippet,
 	}
 	mux.HandleFunc("/{$}", func(w http.ResponseWriter, _ *http.Request) {
-		err := templates["index"].Execute(w, indexData)
+		err := templates["index"].ExecuteTemplate(w, "index.gotmpl", indexData)
 		if err != nil {
 			http.Error(w, err.Error(), http.StatusInternalServerError)
 		}
@@ -132,9 +132,9 @@ func New(runtimeConfig *Config) (*Server, error) {
 		var err error
 		if r.Header.Get("Fetch") == "true" {
 			w.Header().Add("Content-Type", "text/html; charset=utf-8")
-			err = templates["options"].ExecuteTemplate(w, "results", tdata)
+			err = templates["options"].Execute(w, tdata)
 		} else {
-			err = templates["options"].ExecuteTemplate(w, "index", tdata)
+			err = templates["options"].ExecuteTemplate(w, "index.gotmpl", tdata)
 		}
 		if err != nil {
 			slog.Error(fmt.Sprintf("template error: %v", err))