fix(wiki): prefix gacha iframe src with Astro base path#15
Merged
Conversation
The Knowledge Atlas Draw button opens a modal that loads the picked card via an <iframe>. The src was hardcoded as `/card-fragment/<lang>/<kind>/<slug>`, missing the Astro `base` prefix. Locally (base="") it worked. On GitHub Pages, where the site lives under `/advanced-agentic-dev-patterns/`, the iframe requested `/card-fragment/...` against the domain root, so Pages served its default "There isn't a GitHub Pages site here." 404 inside the modal — which is exactly what issue PanQiWei#14's screenshot shows. Fix: pass BASE through `.gacha[data-base]` (mirroring the existing `data-lang` channel for client-side script) and prepend it when building the iframe src. Build verified: with SITE_BASE set, the emitted HTML carries `data-base="/advanced-agentic-dev-patterns"`, and a preview server confirms the prefixed URL returns 200 while the old prefix-less URL still 404s. Closes PanQiWei#14 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #14 — the Knowledge Atlas 抽卡 modal showed a "There isn't a GitHub Pages site here." 404 page instead of the picked card.
Root cause: In
site/src/components/WikiAtlas.astro, the gacha iframe'ssrcwas hardcoded as/card-fragment/<lang>/<kind>/<slug>, missing the Astrobaseprefix. Locally (base="") it worked. On GitHub Pages — where the site lives under/advanced-agentic-dev-patterns/— the iframe requested/card-fragment/...against the domain root, so Pages served its default 404 inside the modal (matching the screenshot in the issue).Fix: Pass
BASEthrough.gacha[data-base](mirroring the existingdata-langchannel for client-side script) and prepend it when building the iframesrc.Test plan
SITE_BASE=/advanced-agentic-dev-patterns npm run buildsucceeds (1077 pages built)data-base="/advanced-agentic-dev-patterns"; bundled JS uses${k}/card-fragment/.../advanced-agentic-dev-patterns/card-fragment/zh/concepts/a2a-protocol→ 200; the old prefix-less path → 404 (confirms the original symptom)🤖 Generated with Claude Code