aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-09-07 16:48:17 +0200
committerWilliam Hergès <william@herges.fr>2025-09-07 16:48:17 +0200
commit26d21b4fa9c703a84b34ceabc13d0d5e19c90e98 (patch)
tree9236f03838a61be1f222a6a87827390d62113bd3
parent996ff551f05dee6db08c8eb4144e7db4a5dbeaa2 (diff)
feat(404): better handle
-rw-r--r--main.go8
-rw-r--r--scss/main.scss1
-rw-r--r--scss/tag.scss1
-rw-r--r--templates/page/404.gohtml24
-rw-r--r--templates/page/legal.gohtml11
5 files changed, 41 insertions, 4 deletions
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"}}
+ <main style="{{ .GetBackground }}">
+ <div class="header">
+ <h1 class="header__title">404 - Not found</h1>
+ <nav>
+ <a href="/">Home</a>
+ </nav>
+ </div>
+ <p>
+ Oh no, you are lost. Do you need help?
+ </p>
+ <nav class="links" style="{{ .Color.Button.GetBackground }}{{ .Color.Button.GetTextColor }}">
+ <div class="link">
+ <a href="/legal">Legal information</a>
+ </div>
+ <div class="link">
+ <a href="/">Home</a>
+ </div>
+ <div class="link">
+ <a href="/now">Now</a>
+ </div>
+ </nav>
+ </main>
+{{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"}}
- <div class="credits-legal" style="{{ .GetBackground }}">
- <h1>Legal information</h1>
+ <main style="{{ .GetBackground }}">
+ <div class="header">
+ <h1 class="header__title">Legal information</h1>
+ <nav>
+ <a href="/">Home</a>
+ </nav>
+ </div>
<p>
The software behind this website was made by <a href="https://anhgelus.world/" target="_blank">Anhgelus Morhtuuzh</a>.
It is available on <a href="https://git.anhgelus.world/anhgelus/now">my forge</a> for free and licensed under
the <a href="https://git.anhgelus.world/anhgelus/now/raw/branch/main/LICENSE" target="_blank">AGPL</a> license.
</p>
{{ .GetLegal }}
- </div>
+ </main>
{{end}}