Skip to content

Commit 4a1aa59

Browse files
Feat: add 404 and improve page routing
1 parent 3cddb29 commit 4a1aa59

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ jobs:
4646
uses: peaceiris/actions-gh-pages@v3
4747
with:
4848
github_token: ${{ secrets.GITHUB_TOKEN }}
49-
publish_dir: ./dist
49+
publish_dir: ./dist
50+
cname: pyversify.github.io

public/404.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>PyVersify</title>
6+
<script type="text/javascript">
7+
// Single Page Apps for GitHub Pages
8+
// https://github.com/rafgraph/spa-github-pages
9+
var pathSegmentsToKeep = 1;
10+
11+
var l = window.location;
12+
l.replace(
13+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
14+
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
15+
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
16+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
17+
l.hash
18+
);
19+
</script>
20+
</head>
21+
<body>
22+
</body>
23+
</html>

public/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyversify.github.io

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function App() {
2222
}, []);
2323

2424
return (
25-
<BrowserRouter>
25+
<BrowserRouter basename="/">
2626
<div className="min-h-screen bg-gray-300 flex flex-col">
2727
{/* Header */}
2828
<Header fontLoaded={fontLoaded} smallLogo={smallLogo} />

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
optimizeDeps: {
89
exclude: ['lucide-react'],
910
},

0 commit comments

Comments
 (0)