Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed May 4, 2022
1 parent 39f5cf3 commit 58395a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ function BreadcrumbsItemLink({
<span itemProp="name">{children}</span>
</Link>
) : (
<span className={className} itemProp="item name">
{children}
</span>
// TODO Google search console doesn't like breadcrumb items without href.
// The schema doesn't seem to require `id` for each `item`, although Google
// insist to infer one, even if it's invalid. Removing `itemProp="item
// name"` for now, since I don't know how to properly fix it.
// See https://github.com/facebook/docusaurus/issues/7241
<span className={className}>{children}</span>
);
}

Expand All @@ -51,16 +54,20 @@ function BreadcrumbsItem({
children,
active,
index,
addMicrodata,
}: {
children: ReactNode;
active?: boolean;
index: number;
addMicrodata: boolean;
}): JSX.Element {
return (
<li
itemScope
itemProp="itemListElement"
itemType="https://schema.org/ListItem"
{...(addMicrodata && {
itemScope: true,
itemProp: 'itemListElement',
itemType: 'https://schema.org/ListItem',
})}
className={clsx('breadcrumbs__item', {
'breadcrumbs__item--active': active,
})}>
Expand Down Expand Up @@ -106,7 +113,11 @@ export default function DocBreadcrumbs(): JSX.Element | null {
{breadcrumbs.map((item, idx) => {
const isLast = idx === breadcrumbs.length - 1;
return (
<BreadcrumbsItem key={idx} active={isLast} index={idx}>
<BreadcrumbsItem
key={idx}
active={isLast}
index={idx}
addMicrodata={!!item.href}>
<BreadcrumbsItemLink href={item.href} isLast={isLast}>
{item.label}
</BreadcrumbsItemLink>
Expand Down
1 change: 1 addition & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ mdxast
mdxhast
metadatum
metastring
microdata
middlewares
minifier
mkcert
Expand Down

0 comments on commit 58395a1

Please sign in to comment.