feat(handle): error 404 by redirecting to /

This commit is contained in:
Anhgelus Morhtuuzh 2024-11-10 15:49:27 +01:00
parent c6b6252270
commit 3e2938791e
No known key found for this signature in database
GPG key ID: CAD341EFA92DDDE5
2 changed files with 6 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import (
"flag" "flag"
"github.com/anhgelus/golatt" "github.com/anhgelus/golatt"
"log/slog" "log/slog"
"net/http"
"os" "os"
) )
@ -58,5 +59,9 @@ func main() {
g.NewTemplate("index", "/", cfg.Person.Name, "", "", &cfg).Handle() g.NewTemplate("index", "/", cfg.Person.Name, "", "", &cfg).Handle()
g.NewTemplate("credits", "/credits", "Credits", "", "", &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") g.StartServer(":80")
} }

View file

@ -38,6 +38,7 @@ a {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
font-size: 16px; font-size: 16px;
margin-left: 1rem;
@media only screen and (max-width: $bp-little) { @media only screen and (max-width: $bp-little) {
gap: 0; gap: 0;
align-items: center; align-items: center;