Repository navigation
Fix GitHub Pages /Wiki subpath - #2
Merged
Merged
Conversation
GitHub Pages serves project sites under /<repo>/, so with base_url "/"
every absolute link (/style.css, /zones/...) resolved to the domain root
and 404'd on openperpetuum.github.io/Wiki/.
The site keeps building against the domain root (local dev, the test
job, and the served output all stay identical). The CI deploy build
then re-points it at the Pages URL:
- config.toml: base_url stays "/" (Zola 0.23 has no config
env-var expansion, so the override lives in the pipeline, not a
${WIKI_BASE_URL} placeholder)
- wiki.yml build job: rewrites base_url to the full Pages URL before
building (sitemap/canonicals pick it up), then runs
tools/rewrite_site_base.py — Zola 0.23 does NOT rewrite
site-absolute links in templates/markdown, so this prefixes every
href="/..." / src="/..." in the built HTML+SVG with /Wiki
(idempotent, skips protocol/data/hash/relative values)
- templates/base.html: <body data-root> carries config.base_url; the
menu-selection, gamma-tier and footnav logic derive the base's path
part ("" at the root, "/Wiki" in production) so both deploys work
- map.js / zone-map.js: withRoot() prefixes JS-built zone links and
the links/image-hrefs inside fetched zone-map SVGs (Zola never sees
those)
- search.js: the index fetch and result links use the base's PATH part
on the current origin (a full-URL fetch would leave the origin)
Verified in a browser served under a /Wiki prefix: styles, nav
highlighting (incl. gamma tiers), world-map thumbnails, inlined zone
maps, search and footnav all work; the local root build passes the
full 93-test suite.
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.
The Pages project site is served under /Wiki/, so with base_url "/" every absolute link (/style.css, /zones/...) resolved to the domain root and 404'd.