1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-23 00:27:30 +00:00

Add proper custom 404 page

This commit is contained in:
Cadence Fish 2020-02-18 21:03:46 +13:00
parent 21ec920516
commit 9d86bdbc74
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1
5 changed files with 25 additions and 19 deletions

27
package-lock.json generated
View File

@ -1340,12 +1340,12 @@
"dev": true "dev": true
}, },
"globule": { "globule": {
"version": "1.3.0", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.0.tgz", "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
"integrity": "sha512-YlD4kdMqRCQHrhVdonet4TdRtv1/sZKepvoxNT4Nrhrp5HI8XFfc8kFlGlBn2myBo80aGp8Eft259mbcUJhgSg==", "integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
"requires": { "requires": {
"glob": "~7.1.1", "glob": "~7.1.1",
"lodash": "~4.17.10", "lodash": "~4.17.12",
"minimatch": "~3.0.2" "minimatch": "~3.0.2"
} }
}, },
@ -1564,12 +1564,9 @@
"dev": true "dev": true
}, },
"is-finite": { "is-finite": {
"version": "1.0.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz",
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w=="
"requires": {
"number-is-nan": "^1.0.0"
}
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
@ -1808,9 +1805,9 @@
} }
}, },
"js-base64": { "js-base64": {
"version": "2.5.1", "version": "2.5.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
"integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==" "integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ=="
}, },
"js-stringify": { "js-stringify": {
"version": "1.0.2", "version": "1.0.2",
@ -2727,8 +2724,8 @@
} }
}, },
"pinski": { "pinski": {
"version": "github:cloudrac3r/pinski#9eb56d90fdd00357451dd5a546dbcca1f9bf114a", "version": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
"from": "github:cloudrac3r/pinski#9eb56d90fdd00357451dd5a546dbcca1f9bf114a", "from": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
"requires": { "requires": {
"mime": "^2.4.4", "mime": "^2.4.4",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",

View File

@ -16,7 +16,7 @@
"mixin-deep": "^2.0.1", "mixin-deep": "^2.0.1",
"node-dir": "^0.1.17", "node-dir": "^0.1.17",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"pinski": "github:cloudrac3r/pinski#9eb56d90fdd00357451dd5a546dbcca1f9bf114a", "pinski": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
"pug": "^2.0.4", "pug": "^2.0.4",
"semver": "^7.1.2", "semver": "^7.1.2",
"sharp": "^0.24.0", "sharp": "^0.24.0",

10
src/site/pug/404.pug Normal file
View File

@ -0,0 +1,10 @@
include includes/error
doctype html
html
head
title Not found | Bibliogram
include includes/head
body.error-page
+error(404, "Page not found.")

View File

@ -2,8 +2,6 @@
include includes/error.pug include includes/error.pug
- const numberFormat = new Intl.NumberFormat().format
doctype html doctype html
html html
head head

View File

@ -19,7 +19,8 @@ subdirs("pug", async (err, dirs) => {
// need to check for and run db upgrades before anything starts using it // need to check for and run db upgrades before anything starts using it
await require("../lib/utils/upgradedb")() await require("../lib/utils/upgradedb")()
//pinski.addRoute("/", "pug/index.pug", "pug") pinski.addRoute("/404", "pug/404.pug", "pug")
pinski.setNotFoundTarget("/404")
pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass") pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass")
pinski.addPugDir("pug", dirs) pinski.addPugDir("pug", dirs)
pinski.addAPIDir("html/static/js/templates/api") pinski.addAPIDir("html/static/js/templates/api")