docs(docs-infra): don't use URL to check for external links (#58955)

For perf reasons, it is more efficient to not rely on creating an `URL` object. Instead we check for the explicit protocol to detect external links.

This will also force us to use relative links, so archived versions & next versions navigate on the current version of the site.

fixes #58954

PR Close #58955
This commit is contained in:
Matthieu Riegler
2024-11-28 15:58:02 +01:00
committed by Pawel Kozlowski
parent a4b86b23cf
commit 66abff6db8
3 changed files with 12 additions and 12 deletions
@@ -62,7 +62,6 @@ export class SecondaryNavigation implements OnInit {
private readonly navigationState = inject(NavigationState);
private readonly platformId = inject(PLATFORM_ID);
private readonly router = inject(Router);
private readonly window = inject(WINDOW);
readonly isSecondaryNavVisible = this.navigationState.isMobileNavVisible;
readonly primaryActiveRouteItem = this.navigationState.primaryActiveRouteItem;
@@ -83,10 +82,10 @@ export class SecondaryNavigation implements OnInit {
private readonly routeMap: Record<string, NavigationItem[]> = {
[PagePrefix.REFERENCE]: getNavigationItemsTree(SUB_NAVIGATION_DATA.reference, (tree) =>
markExternalLinks(tree, this.window.origin),
markExternalLinks(tree),
),
[PagePrefix.DOCS]: getNavigationItemsTree(SUB_NAVIGATION_DATA.docs, (tree) =>
markExternalLinks(tree, this.window.origin),
markExternalLinks(tree),
),
};