Skip to content

Commit

Permalink
Manually create a 404 page. Fixes #12
Browse files Browse the repository at this point in the history
Svelte Kit doesn't offer a good way to generate single HTML pages like 404.html, so I have to generate a regular page and then move it. Solution suggested here: sveltejs/kit#1209 (comment)
  • Loading branch information
cuibonobo committed Aug 23, 2021
1 parent 9cfcdf8 commit 8012da3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"scripts": {
"dev": "svelte-kit dev",
"build": "npm run clean && svelte-kit build",
"build:sitemap": "svelte-sitemap --domain https://cuibonobo.com",
"build:404": "ncp ./build/404/index.html ./build/404.html && rimraf ./build/404",
"clean": "rimraf ./build",
"clean:all": "npm run clean && rimraf ./svelte-kit",
"postbuild": "svelte-sitemap --domain https://cuibonobo.com",
"postbuild": "npm run build:sitemap && npm run build:404",
"preview": "svelte-kit preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
Expand Down Expand Up @@ -40,6 +42,7 @@
"gray-matter": "^4.0.3",
"marked": "^2.1.3",
"moment": "^2.29.1",
"ncp": "^2.0.0",
"node-glob": "^1.2.0",
"postcss": "^8.3.6",
"prettier": "^2.3.2",
Expand Down
10 changes: 10 additions & 0 deletions src/routes/404.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
import Title from '../components/Title.svelte';
</script>

<Title title="404: Not Found!" />
<p>
<a href="https://en.wikipedia.org/wiki/Link_rot">Link rot</a>] is a serious problem on the
internet and I'm sorry to have contributed to it. Hopefully you'll find what you're looking for by
using the navigation links above.
</p>

0 comments on commit 8012da3

Please sign in to comment.