fix(nx-dev): update breadcrumb links to match sidebar#34500
fix(nx-dev): update breadcrumb links to match sidebar#34500barbados-clemens merged 1 commit intomasterfrom
Conversation
|
View your CI Pipeline Execution ↗ for commit 45833d2
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
added new component to handle instead of making the index card component dual purposed atm. felt easier to maintain for the different impl needs.
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We've fixed the broken breadcrumb link by removing the URL construction logic for sidebar groups. The previous implementation was generating links like /docs/reference/devkit/ngcli-adapter using a slugify function that converted underscores to dashes, but the actual URLs use underscores (e.g., /docs/reference/devkit/ngcli_adapter). Now, only actual sidebar link entries (which have correct hrefs from the sidebar configuration) will be clickable in breadcrumbs, while group labels appear as non-clickable text.
Warning
❌ We could not verify this fix.
Suggested Fix changes
diff --git a/astro-docs/src/components/layout/Breadcrumbs.astro b/astro-docs/src/components/layout/Breadcrumbs.astro
index 202690b60d..dc8f20f0cd 100644
--- a/astro-docs/src/components/layout/Breadcrumbs.astro
+++ b/astro-docs/src/components/layout/Breadcrumbs.astro
@@ -8,36 +8,24 @@ type Crumb = {
current: boolean;
};
-function slugify(label: string): string {
- return label
- .replace(/\.NET/g, 'dotnet')
- .toLowerCase()
- .replace(/[^a-z0-9]+/g, '-')
- .replace(/^-+|-+$/g, '');
-}
-
// --- Primary: Sidebar-based breadcrumbs ---
const sidebar = Astro.locals.starlightRoute.sidebar;
function findBreadcrumbPath(
entries: typeof sidebar,
- path: Crumb[] = [],
- slugSegments: string[] = []
+ path: Crumb[] = []
): Crumb[] | null {
for (const entry of entries) {
if (entry.type === 'link' && entry.isCurrent) {
return [...path, { label: entry.label, href: entry.href, current: true }];
}
if (entry.type === 'group') {
- const currentSlugs = [...slugSegments, slugify(entry.label)];
- const groupHref = `/docs/${currentSlugs.join('/')}`;
const result = findBreadcrumbPath(
entry.entries,
[
...path,
- { label: entry.label, href: groupHref, current: false },
- ],
- currentSlugs
+ { label: entry.label, href: undefined, current: false },
+ ]
);
if (result) return result;
}
Or Apply changes locally with:
npx nx-cloud apply-locally ND8C-O5Uj
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
a555e97 to
b10921e
Compare
b10921e to
45833d2
Compare
navigation of the breadcrumbs could lead to confusing state since they were based around the folder structure. Breadcrumbs are now based around the sidebar structure so they match the hierarchy of content. Note: I left the existing index file based route pages in place in case there are any links people have booked marked/linked to in other locations. these will get cleaned up when we finally rewrite all the URLs to their new content locations (cherry picked from commit 7528cc5)
navigation of the breadcrumbs could lead to confusing state since they were based around the folder structure.
Breadcrumbs are now based around the sidebar structure so they match the hierarchy of content.
Note: I left the existing index file based route pages in place in case there are any links people have booked marked/linked to in other locations. these will get cleaned up when we finally rewrite all the URLs to their new content locations