Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-mangos-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/doctocat-nextjs': patch
---

Fixed a bug that caused breadcrumbs to display an incorrect title for pages with tabs
16 changes: 9 additions & 7 deletions packages/theme/components/layout/root-layout/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,18 @@ export function Theme({pageMap, children}: ThemeProps) {
(index < array.length - 1 &&
nextItem.name === 'index' &&
item.route === nextItem.route &&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
!nextItem.frontMatter?.['tab-label']) ||
(item.name === 'index' &&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
item.frontMatter?.['tab-label'])
!nextItem.frontMatter['tab-label']) ||
(item.name === 'index' && item.frontMatter['tab-label'])
Comment thread
danielguillan marked this conversation as resolved.
)
})
.map((item, index, visibleItems) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const itemTitle = item.frontMatter?.['tab-label'] || item.title
const itemTitle = Array.isArray(item.children)
Comment thread
danielguillan marked this conversation as resolved.
? item.children.find(child => child.name === 'index')?.frontMatter.title ||
item.frontMatter['tab-label'] ||
item.frontMatter.title ||
item.title
: item.frontMatter['tab-label'] || item.frontMatter.title || item.title

const isLastItem = index === visibleItems.length - 1

return (
Expand Down
Loading