Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme-classic): do not add microdata item prop to trailing breadcrumb #7179

Merged
merged 1 commit into from
Apr 15, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,20 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
function BreadcrumbsItemLink({
children,
href,
isLast,
}: {
children: ReactNode;
href?: string;
href: string | undefined;
isLast: boolean;
}): JSX.Element {
const className = 'breadcrumbs__link';
if (isLast) {
return (
<span className={className} itemProp="name">
{children}
</span>
);
}
return href ? (
<Link className={className} href={href} itemProp="item">
<span itemProp="name">{children}</span>
Expand Down Expand Up @@ -93,17 +102,16 @@ export default function DocBreadcrumbs(): JSX.Element | null {
itemScope
itemType="https://schema.org/BreadcrumbList">
{homePageRoute && <HomeBreadcrumbItem />}
{breadcrumbs.map((item, idx) => (
<BreadcrumbsItem
key={idx}
active={idx === breadcrumbs.length - 1}
index={idx}>
<BreadcrumbsItemLink
href={idx < breadcrumbs.length - 1 ? item.href : undefined}>
{item.label}
</BreadcrumbsItemLink>
</BreadcrumbsItem>
))}
{breadcrumbs.map((item, idx) => {
const isLast = idx === breadcrumbs.length - 1;
return (
<BreadcrumbsItem key={idx} active={isLast} index={idx}>
<BreadcrumbsItemLink href={item.href} isLast={isLast}>
{item.label}
</BreadcrumbsItemLink>
</BreadcrumbsItem>
);
})}
</ul>
</nav>
);
Expand Down