Skip to content

Commit 6397340

Browse files
committed
fix 404
1 parent 0ef7d0e commit 6397340

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/pages.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,18 @@ jobs:
7777
cp -r website/out/* _site/
7878
mkdir -p _site/playground
7979
cp -r playground/dist/* _site/playground/
80-
# SPA fallback — serve index.html for all playground routes
81-
cp _site/playground/index.html _site/playground/404.html
80+
# SPA fallback for playground routes
81+
# GitHub Pages only checks root 404.html, so use a redirect
82+
cat > _site/404.html << 'FOUROHFOUR'
83+
<!DOCTYPE html><html><head><meta charset="utf-8"><script>
84+
var p = window.location.pathname;
85+
if (p.startsWith('/gnata-sqlite/playground')) {
86+
var base = '/gnata-sqlite/playground/';
87+
var route = p.slice(base.length);
88+
window.location.replace(base + '?route=' + encodeURIComponent(route) + window.location.hash);
89+
}
90+
</script></head><body></body></html>
91+
FOUROHFOUR
8292
8393
- uses: actions/upload-pages-artifact@v3
8494

0 commit comments

Comments
 (0)