aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-10 15:49:27 +0100
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-10 15:49:27 +0100
commit3e2938791e23c4ceee1fc8093b03ccd6658e4a97 (patch)
treeedbaba5281be92a09d0e8a36da2ee5aab57cb4a6
parentc6b6252270e94d4512884187135df1c1a20f5734 (diff)
feat(handle): error 404 by redirecting to /
-rw-r--r--main.go5
-rw-r--r--scss/main.scss1
2 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index 11701be..7c2b48a 100644
--- a/main.go
+++ b/main.go
@@ -6,6 +6,7 @@ import (
"flag"
"github.com/anhgelus/golatt"
"log/slog"
+ "net/http"
"os"
)
@@ -58,5 +59,9 @@ func main() {
g.NewTemplate("index", "/", cfg.Person.Name, "", "", &cfg).Handle()
g.NewTemplate("credits", "/credits", "Credits", "", "", &cfg).Handle()
+ g.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) {
+ http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
+ }
+
g.StartServer(":80")
}
diff --git a/scss/main.scss b/scss/main.scss
index 77c1b3f..80bd37c 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -38,6 +38,7 @@ a {
display: flex;
gap: 1rem;
font-size: 16px;
+ margin-left: 1rem;
@media only screen and (max-width: $bp-little) {
gap: 0;
align-items: center;