Skip to content

Fix public asset 404s on GitHub Pages - #23

Merged
xballoy merged 1 commit into
mainfrom
fix/github-pages-asset-base-path
Aug 17, 2026
Merged

Fix public asset 404s on GitHub Pages#23
xballoy merged 1 commit into
mainfrom
fix/github-pages-asset-base-path

Conversation

@xballoy

@xballoy xballoy commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • me.jpg, claude-code-react-questions.mp4, and agile-software-development.jpg were referenced as root-absolute string literals (:src="'/me.jpg'"), which Vite never rewrites with the configured --base, so on GitHub Pages they 404'd against the domain root instead of the deployed sub-path (e.g. /presentations/ai-tech-debt/fr/).
  • Added a <script setup> block exposing import.meta.env.BASE_URL in each affected slide and prepend it in the binding, so the built asset URL correctly includes the deploy base path.

Test plan

  • slidev build with production --base flags for ai-tech-debt, solid, ai-for-beginners, and opaque-types (fr/en where applicable) — all succeed
  • Inspected built JS bundles and confirmed asset URLs are correctly prefixed, e.g. /presentations/ai-tech-debt/fr/me.jpg, /presentations/solid/fr/agile-software-development.jpg

Root-absolute asset paths bound via :src="'/foo.jpg'" bypass Vite's
--base rewriting, so browsers requested them from the domain root
instead of the deployed sub-path. Resolve BASE_URL in a script setup
block and prepend it in the binding instead.
@xballoy
xballoy merged commit 6bad306 into main Aug 17, 2026
5 checks passed
@xballoy
xballoy deleted the fix/github-pages-asset-base-path branch August 17, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant