404, travel
Jes Olson j3s@c3f.net
Tue, 08 Nov 2022 20:20:48 -0800
3 files changed,
9 insertions(+),
7 deletions(-)
M
main.go
→
main.go
@@ -97,12 +97,8 @@
func templateCombobulator(requestedPath string) (template.Template, error) { layoutPath := filepath.Join("templates", "layout.html") - info, err := os.Stat(requestedPath) + _, err := os.Stat(requestedPath) if err != nil { - return template.Template{}, err - } - - if info.IsDir() { return template.Template{}, err }@@ -126,7 +122,7 @@
tmpl, err := templateCombobulator(requestedPath) if err != nil { log.Println(err.Error()) - http.Error(w, http.StatusText(500), 500) + http.Error(w, http.StatusText(404), 404) return }
A
templates/404.html
@@ -0,0 +1,6 @@
+{{define "title"}}not found x__x{{end}} +{{define "body"}} +<pre> +(◎_◎;) 404 not found +</pre> +{{end}}
M
templates/travel.html
→
templates/travel.html
@@ -1,4 +1,4 @@
-{{define "title"}}me{{end}} +{{define "title"}}tools/travel{{end}} {{define "body"}} <p>this is my travel checklist. you can use it too if you want i guess.</p> <h4>clothes</h4>