mirror of
https://github.com/leptos-rs/book.git
synced 2025-12-27 11:06:43 -05:00
feat: add spa routing setup command (#245)
When hosting Leptos CSR on Github Pages, to get routing working correctly, the 404.html will need to allow Leptos Router to handle requests. A pretty straightforward way to do this is to simply copy index.html to 404.html. This change adds a Github Action step that does that automatically.
This commit is contained in:
@@ -86,6 +86,10 @@ Deploying a Leptos CSR app to Github pages is a simple affair. First, go to your
|
|||||||
# will obviously return error 404 not found.
|
# will obviously return error 404 not found.
|
||||||
run: ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
|
run: ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
|
||||||
|
|
||||||
|
# Copy index.html to 404.html for SPA routing
|
||||||
|
# Will allow routing to work if client enters from any route
|
||||||
|
# - name: Copy index.html to 404.html
|
||||||
|
# run: cp dist/index.html dist/404.html
|
||||||
|
|
||||||
# Deploy to gh-pages branch
|
# Deploy to gh-pages branch
|
||||||
# - name: Deploy 🚀
|
# - name: Deploy 🚀
|
||||||
|
|||||||
Reference in New Issue
Block a user