mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Pawel Kozlowski
parent
a4b86b23cf
commit
66abff6db8
@@ -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),
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user