Fix breadcrumbs - #52
Conversation
There was a problem hiding this comment.
Pull Request Overview
Fix duplicate breadcrumb entries and add tab-based labels to navigation.
- Filters out redundant index pages in the breadcrumb trail
- Uses frontMatter
tab-labelfor titles and updates the last-item selection logic - Adds a changeset entry for the patch release
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/theme/components/layout/root-layout/Theme.tsx | Refactor breadcrumb rendering: filter duplicates, apply tab-label, and update selected |
| .changeset/cool-cows-shake.md | Add patch changeset describing the breadcrumb fix |
Comments suppressed due to low confidence (1)
packages/theme/components/layout/root-layout/Theme.tsx:153
- Add unit tests covering scenarios for folder-index collisions and tab-label filtering to ensure the breadcrumb logic behaves as expected.
.filter((item, index, array) => {
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
| !nextItem.frontMatter?.['tab-label']) || |
There was a problem hiding this comment.
I'm not sure how to avoid disabling the linter here, the fontMatter check is actually necessary.
There was a problem hiding this comment.
Is checking for frontMatter required? I thought it was always available through Nextra, but empty if nothing was added there? If that's the case you could remove it the optional chain. Or are you trying to check if tab-label is available on the frontMatter object?
There was a problem hiding this comment.
If frontMatter is optional, we need to adjust the types in types.ts to reflect that. But that will likely lead to a bigger job so in that case, let's leave as-is and mop up later.
rezrah
left a comment
There was a problem hiding this comment.
This is looking great Dani.
Fixes the issue of duplicate items on index pages and adds tabbed navigation labels to breadcrumbs.