From 2d495b72846e1caae4f5c07591fd9544dd5e1219 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Sat, 1 Aug 2026 12:59:26 +0200 Subject: [PATCH] fix(docs-support): stop double-prefixing SideNav links with rootURL 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 --- packages/docs-support/src/side-nav.gts | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/packages/docs-support/src/side-nav.gts b/packages/docs-support/src/side-nav.gts index 27924285b..2472d2811 100644 --- a/packages/docs-support/src/side-nav.gts +++ b/packages/docs-support/src/side-nav.gts @@ -1,6 +1,5 @@ import Component from '@glimmer/component'; import { on } from '@ember/modifier'; -import { service } from '@ember/service'; import { sentenceCase } from 'change-case'; import { link } from 'ember-primitives/helpers'; @@ -8,7 +7,6 @@ import { PageNav } from 'kolay/components'; import { getAnchor } from 'should-handle-link'; import type { TOC } from '@ember/component/template-only'; -import type RouterService from '@ember/routing/router-service'; import type { Page } from 'kolay'; type CustomPage = Page & { @@ -26,18 +24,6 @@ function fixWords(text: string) { } } -const joinUrl = (...strs: string[]) => { - const prefix = strs[0]?.startsWith('/') ? '/' : ''; - - return ( - prefix + - strs - .map((s) => s.replace(/^\//, '').replace(/\/$/, '')) - .filter((x) => !!x) - .join('/') - ); -}; - /** * Converts 1-2-hyphenated-thing * to @@ -114,12 +100,6 @@ export class SideNav extends Component<{ onClick?: () => void; }; }> { - @service('router') declare router: RouterService; - - get rootUrl() { - return this.router.rootURL; - } - closeNav = (event: Event) => { if (!getAnchor(event)) return; @@ -143,7 +123,7 @@ export class SideNav extends Component<{ <:page as |x|> @@ -152,7 +132,7 @@ export class SideNav extends Component<{ <:collection as |x|> {{#if x.index}}