Skip to content

Node.js based forum software built for the modern web

new 404 page

Barış Soner Uşaklı73d02725f062
diff --git a/public/language/en-GB/global.json b/public/language/en-GB/global.json
index c4b031520b..75f9e2251b 100644
--- a/public/language/en-GB/global.json
+++ b/public/language/en-GB/global.json
@@ -6,7 +6,7 @@
"403.message": "You seem to have stumbled upon a page that you do not have access to.",
"403.login": "Perhaps you should <a class=\"alert-link\" href='%1/login'>try logging in</a>?",
"404.title": "Not Found",
- "404.message": "You seem to have stumbled upon a page that does not exist. Return to the <a class=\"alert-link\" href='%1/'>home page</a>.",
+ "404.message": "You seem to have stumbled upon a page that does not exist.<br/><div class=\"text-sm text-muted\">Return to the <a href='%1/'>home page</a>.</div>",
"500.title": "Internal Error.",
"500.message": "Oops! Looks like something went wrong!",
"400.title": "Bad Request.",
diff --git a/src/controllers/404.js b/src/controllers/404.js
index 3843d6bace..8b5fda6ebf 100644
--- a/src/controllers/404.js
+++ b/src/controllers/404.js
@@ -54,11 +54,16 @@ exports.send404 = async function (req, res) {
bodyClass: helpers.buildBodyClass(req, res),
});
}
-
+ const icons = [
+ 'fa-hippo', 'fa-cat', 'fa-otter',
+ 'fa-dog', 'fa-cow', 'fa-fish',
+ 'fa-dragon', 'fa-horse', 'fa-dove',
+ ];
await middleware.buildHeaderAsync(req, res);
await res.render('404', {
path: validator.escape(path),
title: '[[global:404.title]]',
bodyClass: helpers.buildBodyClass(req, res),
+ icon: icons[Math.floor(Math.random() * icons.length)],
});
};
diff --git a/src/views/404.tpl b/src/views/404.tpl
index 5d1fb9d43c..e0a3d68ed2 100644
--- a/src/views/404.tpl
+++ b/src/views/404.tpl
@@ -1,4 +1,12 @@
-<div class="alert alert-danger">
- <strong>{path} [[global:404.title]]</strong>
- <p>{{{ if error }}}{error}{{{ else }}}[[global:404.message, {config.relative_path}]]{{{ end }}}</p>
-</div>
\ No newline at end of file
+<div class="flex-fill">
+ <h2 class="fw-semibold tracking-tight text-center">[[global:404.title]]</h2>
+
+ <div class="mx-auto">
+ <div class="d-flex flex-column gap-3 justify-content-center text-center">
+ <div class="mx-auto p-4 bg-light border rounded">
+ <i class="text-secondary fa fa-fw fa-4x {{{ if icon }}}{icon}{{{ else }}}fa-otter{{{ end }}}"></i>
+ </div>
+ {{{ if error }}}{error}{{{ else }}}[[global:404.message, {config.relative_path}]]{{{ end }}}
+ </div>
+ </div>
+</div>
diff --git a/src/views/outgoing.tpl b/src/views/outgoing.tpl
index d806b935d3..60cbb92074 100644
--- a/src/views/outgoing.tpl
+++ b/src/views/outgoing.tpl
@@ -1,12 +1,7 @@
-<div class="outgoing d-flex flex-column gap-3">
- <!-- IMPORT partials/breadcrumbs.tpl -->
- <div class="card card-header p-3 border-0 shadow-none mb-3 gap-2">
- <h4>
- [[notifications:outgoing_link_message, {title}]]
- </h4>
- <div class="d-flex flex-column gap-2">
- <a href="{outgoing}" rel="nofollow noopener noreferrer" class="btn btn-primary text-truncate">[[notifications:continue_to, {outgoing}]]</a>
- <a href="#" class="btn btn-warning" onclick="history.back(); return false;">[[notifications:return_to, {title}]]</a>
- </div>
- </div>
-</div>
\ No newline at end of file
+<div class="outgoing d-flex flex-column gap-3 align-items-center">
+ <h4>
+ [[notifications:outgoing_link_message, {title}]]
+ </h4>
+ <a href="{outgoing}" rel="nofollow noopener noreferrer" class="btn btn-primary">[[notifications:continue_to, {outgoing}]]</a>
+ <a href="#" class="btn btn-warning" onclick="history.back(); return false;">[[notifications:return_to, {title}]]</a>
+</div>