From db3e3192e244ce57433dc6d78fc4cfacc18d6e43 Mon Sep 17 00:00:00 2001 From: juancwu Date: Wed, 14 Jan 2026 01:56:40 +0000 Subject: [PATCH] add not found page --- internal/handler/home.go | 5 +++-- internal/ui/pages/public_notfound.templ | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 internal/ui/pages/public_notfound.templ diff --git a/internal/handler/home.go b/internal/handler/home.go index 50d0ca0..41b8f0c 100644 --- a/internal/handler/home.go +++ b/internal/handler/home.go @@ -4,6 +4,8 @@ import ( "net/http" "git.juancwu.dev/juancwu/budgit/internal/ctxkeys" + "git.juancwu.dev/juancwu/budgit/internal/ui" + "git.juancwu.dev/juancwu/budgit/internal/ui/pages" ) type homeHandler struct{} @@ -23,6 +25,5 @@ func (h *homeHandler) HomePage(w http.ResponseWriter, r *http.Request) { } func (home *homeHandler) NotFoundPage(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusNotFound) - w.Write([]byte("404 Page Not Found")) + ui.Render(w, r, pages.NotFound()) } diff --git a/internal/ui/pages/public_notfound.templ b/internal/ui/pages/public_notfound.templ new file mode 100644 index 0000000..69d152a --- /dev/null +++ b/internal/ui/pages/public_notfound.templ @@ -0,0 +1,18 @@ +package pages + +import "git.juancwu.dev/juancwu/budgit/internal/ui/layouts" + +templ NotFound() { + @layouts.Base() { +
+
+

404

+

Page Not Found

+

The page you are looking for does not exist.

+ + ← Back to Home + +
+
+ } +}