From b3feb0100985fee2ed08b38db51fff853e66c468 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Wed, 4 May 2022 22:54:24 +0800 Subject: [PATCH] fix(theme-classic): remove breadcrumb items without href from microdata (#7304) --- .../src/theme/DocBreadcrumbs/index.tsx | 25 +++++++++++++------ project-words.txt | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx index 795a3d0b7187..eaaa85a8b7a9 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx @@ -40,9 +40,12 @@ function BreadcrumbsItemLink({ {children} ) : ( - - {children} - + // 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 + {children} ); } @@ -51,16 +54,20 @@ function BreadcrumbsItem({ children, active, index, + addMicrodata, }: { children: ReactNode; active?: boolean; index: number; + addMicrodata: boolean; }): JSX.Element { return (
  • @@ -106,7 +113,11 @@ export default function DocBreadcrumbs(): JSX.Element | null { {breadcrumbs.map((item, idx) => { const isLast = idx === breadcrumbs.length - 1; return ( - + {item.label} diff --git a/project-words.txt b/project-words.txt index da09abfbe435..2523f7948f49 100644 --- a/project-words.txt +++ b/project-words.txt @@ -158,6 +158,7 @@ mdxast mdxhast metadatum metastring +microdata middlewares minifier mkcert