Skip to content

Fix GitHub Pages /Wiki subpath - #2

Merged
clouths merged 1 commit into
mainfrom
fix-github-page-config
Oct 5, 2026
Merged

clouths merged 1 commit into
mainfrom
fix-github-page-config

Conversation

@clouths

@clouths clouths commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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.

  • Site still builds against the domain root (local + test job unchanged, 93 tests green)
  • CI deploy build re-points base_url at the Pages URL, then prefixes all built links with /Wiki (Zola 0.23 does not rewrite site-absolute links)
  • JS (maps, search, nav highlighting) reads the base from body[data-root] so both deploys work

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.
@clouths clouths self-assigned this Oct 5, 2026
@clouths
clouths merged commit e4bcdb0 into main Oct 5, 2026
7 checks passed
@clouths
clouths deleted the fix-github-page-config branch October 5, 2026 22:47
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