Skip to content

Commit 490fc76

Browse files
committed
feat: add 404
1 parent 86a72bb commit 490fc76

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

404.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Feekool</title>
6+
<script type="text/javascript">
7+
// Single Page Apps for GitHub Pages
8+
// MIT License
9+
// https://github.com/rafgraph/spa-github-pages
10+
// This script takes the current url and converts the path and query
11+
// string into just a query string, and then redirects the browser
12+
// to the new url with only a query string and hash fragment,
13+
// e.g., https://www.foo.tld/one/two?a=b&c=d#qwe, becomes
14+
// https://www.foo.tld/?/one/two&a=b~and~c=d#qwe
15+
// Note: this 404.html file must be at least 512 bytes for it to work
16+
// with Internet Explorer (it is currently > 512 bytes)
17+
18+
// If you're creating a Project Pages site and NOT using a custom domain,
19+
// then set pathSegmentsToKeep to 1 (enterprise users may need to set it to > 1).
20+
// This way the code will only replace the route part and not the real repository name,
21+
// which is what we want for GitHub Pages.
22+
// If you're using a custom domain, set pathSegmentsToKeep to 0.
23+
var pathSegmentsToKeep = 1;
24+
25+
var l = window.location;
26+
l.replace(
27+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
28+
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
29+
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
30+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
31+
l.hash
32+
);
33+
</script>
34+
</head>
35+
<body>
36+
</body>
37+
</html>

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: '/',
78
build: {
89
minify: 'esbuild',
910
},

0 commit comments

Comments
 (0)