Skip to content

Commit 13ec22c

Browse files
fix: add base path configuration for GitHub Pages deployment
Configure SvelteKit to use '/afterpython' base path in production to fix 404 errors when deployed to github.io subdirectory
1 parent 4baf71e commit 13ec22c

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666

6767
- name: Build website
6868
run: ap build
69+
env:
70+
NODE_ENV: production
6971

7072
- name: Upload artifact
7173
uses: actions/upload-pages-artifact@v3

afterpython/_website/svelte.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const config = {
1616
precompress: false,
1717
strict: true,
1818
}),
19+
paths: {
20+
base: process.env.NODE_ENV === 'production' ? '/afterpython' : '',
21+
},
1922
alias: {
2023
// '@': 'src/',
2124
'$components': 'src/lib/components/',

afterpython/templates/deploy-workflow-template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666

6767
- name: Build website
6868
run: ap build
69+
env:
70+
NODE_ENV: production
6971

7072
- name: Upload artifact
7173
uses: actions/upload-pages-artifact@v3

0 commit comments

Comments
 (0)