Skip to content

fix(docs-support): stop double-prefixing SideNav links with rootURL - #797

Merged
NullVoxPopuli merged 1 commit into
universal-ember:mainfrom
patricklx:fix/side-nav-joinurl-double-prefix
Aug 1, 2026
Merged

NullVoxPopuli merged 1 commit into
universal-ember:mainfrom
patricklx:fix/side-nav-joinurl-double-prefix

Conversation

@patricklx

Copy link
Copy Markdown
Contributor

Summary

kolay's page.path / collection.index.page.path already include the
app's rootURL (see router.hrefFor's doc comment: "Includes the rootURL,
like page.path" in src/browser/services/docs.ts). SideNav was
additionally wrapping those paths in joinUrl(this.rootUrl, path), which
prefixed rootURL a second time.

For apps whose rootURL is / this is a harmless no-op (joinUrl dedupes
adjacent slashes), which is why it wasn't caught before. But for any app
deployed under a subpath (rootURL other than /), every link rendered by
SideNav points at a URL like /subpath/subpath/some-page, which doesn't
resolve to a real route and breaks in-app navigation from the side nav.

Changes

  • SideNav now passes x.page.path / x.index.page.path straight through
    as @href, without the extra joinUrl(this.rootUrl, ...) wrapping.
  • Removed the now-unused joinUrl helper, router service injection, and
    rootUrl getter.

We're carrying this as a pnpm patch in downstream consumer
carbon-components-ember
where rootURL isn't /; happy to adjust the fix if there's a reason the
double-prefixing was intentional.

Test plan

  • pnpm lint:hbs / pnpm lint:prettier pass on the changed file
  • Manually verified in the downstream consumer's docs app that side nav
    links resolve correctly once the double rootURL prefix is removed

Page/collection paths returned by kolay's PageNav already include the
app's rootURL, so wrapping them in joinUrl(this.rootUrl, path) prefixed
rootURL twice. For apps whose rootURL isn't '/' (e.g. deployed under a
subpath), every sidebar link pointed at a nonexistent route.

Signed-off-by: Patrick Pircher <patrick.pircher@ibm.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
Project Preview URL
Docs https://5b7f136d.ember-primitives.pages.dev

Logs

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Aug 1, 2026
@NullVoxPopuli
NullVoxPopuli merged commit 2bd7643 into universal-ember:main Aug 1, 2026
19 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants