Skip to content

Commit 2b5704b

Browse files
committed
fix: github pages blank issue, add base config, hashrouter, 404.html, and env improvements
1 parent d85e918 commit 2b5704b

File tree

6 files changed

+2296
-3942
lines changed

6 files changed

+2296
-3942
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ jobs:
2828
env:
2929
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
3030

31+
- name: Verify build output
32+
run: |
33+
echo "Checking if dist directory exists..."
34+
ls -la dist/
35+
echo "Checking if index.html exists..."
36+
cat dist/index.html
37+
3138
- name: Deploy to GitHub Pages
3239
uses: peaceiris/actions-gh-pages@v3
3340
if: github.ref == 'refs/heads/main'

index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,30 @@
1919
<meta property="twitter:title" content="AI Profile Assistant" />
2020
<meta property="twitter:description" content="AI Profile Assistant - Your Professional Profile" />
2121
<meta property="twitter:image" content="/placeholder-og-image.png" />
22+
23+
<!-- GitHub Pages SPA Support -->
24+
<script type="text/javascript">
25+
// Single Page Apps for GitHub Pages
26+
// MIT License
27+
// https://github.com/rafgraph/spa-github-pages
28+
// This script checks to see if a redirect is present in the query string,
29+
// converts it back into the correct url and adds it to the
30+
// browser's history using window.history.replaceState(...),
31+
// which won't cause the browser to attempt to load the new url.
32+
// When the single page app is loaded further down in this file,
33+
// the correct url will be waiting in the browser's history for
34+
// the single page app to route accordingly.
35+
(function(l) {
36+
if (l.search[1] === '/' ) {
37+
var decoded = l.search.slice(1).split('&').map(function(s) {
38+
return s.replace(/~and~/g, '&')
39+
}).join('?');
40+
window.history.replaceState(null, null,
41+
l.pathname.slice(0, -1) + decoded + l.hash
42+
);
43+
}
44+
}(window.location))
45+
</script>
2246
</head>
2347
<body>
2448
<div id="root"></div>

0 commit comments

Comments
 (0)