Skip to content

feat(docs): enable path-based SPA routing via 404.html#48

Merged
ErickXavier merged 1 commit into
mainfrom
feat/path-based-routing
Jun 16, 2026
Merged

feat(docs): enable path-based SPA routing via 404.html#48
ErickXavier merged 1 commit into
mainfrom
feat/path-based-routing

Conversation

@ErickXavier

Copy link
Copy Markdown
Collaborator

Summary

  • Switches the Elements docs site from hash-based to path-based SPA routing, matching the Core site (no-js.dev)
  • Adds <base href="/"> for correct relative URL resolution on deep paths
  • Sets useHash: false in the NoJS router config
  • Updates syncSidebar() and syncPrevNext() JS helpers to use location.pathname and popstate instead of location.hash and hashchange
  • Updates prev/next navigation links from href="#/path" to href="/path"
  • Creates docs/404.html as a byte-for-byte copy of docs/index.html for GitHub Pages deep-link fallback

Test plan

  • Verify the docs site loads at the root URL (/)
  • Navigate to a deep route (e.g., /accordion) and verify the page renders
  • Refresh on a deep route and verify the 404.html fallback serves the SPA correctly
  • Verify sidebar visibility toggles correctly (hidden on home, visible on component pages)
  • Verify prev/next navigation links work and point to path-based URLs
  • Verify mobile navigation links work

Switch the Elements docs site from hash-based to path-based SPA routing
to match the Core site (no-js.dev). Adds <base href="/">, sets
useHash: false, updates syncSidebar/syncPrevNext to use
location.pathname and popstate, and creates 404.html as a copy of
index.html for the GitHub Pages deep-link fallback.
@ErickXavier ErickXavier merged commit 31d94f1 into main Jun 16, 2026
1 check passed
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