From 26d21b4fa9c703a84b34ceabc13d0d5e19c90e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 16:48:17 +0200 Subject: feat(404): better handle --- main.go | 8 ++++++++ scss/main.scss | 1 + scss/tag.scss | 1 - templates/page/404.gohtml | 24 ++++++++++++++++++++++++ templates/page/legal.gohtml | 11 ++++++++--- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 templates/page/404.gohtml diff --git a/main.go b/main.go index 6df8e79..3f8d3c2 100644 --- a/main.go +++ b/main.go @@ -140,6 +140,14 @@ func main() { } g.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) { + g.Render(w, "404", &golatt.TemplateData{ + Title: "Not found :(", + SEO: &golatt.SeoData{ + URL: r.URL.Path, + Description: "Not found", + }, + Data: &cfg, + }) http.Redirect(w, r, "/", http.StatusTemporaryRedirect) } diff --git a/scss/main.scss b/scss/main.scss index adb87be..95213cf 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -118,6 +118,7 @@ h3 { h4 { font-size: 1.25rem; font-weight: bold; + margin-bottom: 0.5rem; } ul, ol { diff --git a/scss/tag.scss b/scss/tag.scss index a604380..516ecdb 100644 --- a/scss/tag.scss +++ b/scss/tag.scss @@ -17,7 +17,6 @@ } & p { display: block; - margin-top: 0.5rem; } } diff --git a/templates/page/404.gohtml b/templates/page/404.gohtml new file mode 100644 index 0000000..76f9128 --- /dev/null +++ b/templates/page/404.gohtml @@ -0,0 +1,24 @@ +{{define "body"}} +
+
+

404 - Not found

+ +
+

+ Oh no, you are lost. Do you need help? +

+ +
+{{end}} \ No newline at end of file diff --git a/templates/page/legal.gohtml b/templates/page/legal.gohtml index b3a3a54..0ed112a 100644 --- a/templates/page/legal.gohtml +++ b/templates/page/legal.gohtml @@ -1,11 +1,16 @@ {{define "body"}} - + {{end}} -- cgit v1.2.3