From 12a7305238098a1c5f80d844b3ec59ab2a88547b Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 14 Mar 2022 08:45:47 +0800 Subject: [PATCH] feat: add SEO microdata for doc breadcrumbs (#6697) * feat: add SEO microdata for doc breadcrumbs * refactor * refactor --- .../src/theme/DocBreadcrumbs/index.tsx | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx index f912aac438a4..cdb69965ec61 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx @@ -26,11 +26,13 @@ function BreadcrumbsItemLink({ }): JSX.Element { const className = clsx('breadcrumbs__link', styles.breadcrumbsItemLink); return href ? ( - - {children} + + {children} ) : ( - {children} + + {children} + ); } @@ -38,16 +40,22 @@ function BreadcrumbsItemLink({ function BreadcrumbsItem({ children, active, + index, }: { children: ReactNode; active?: boolean; + index: number; }): JSX.Element { return (
  • {children} +
  • ); } @@ -55,9 +63,13 @@ function BreadcrumbsItem({ function HomeBreadcrumbItem() { const homeHref = useBaseUrl('/'); return ( - - 🏠 - +
  • + + 🏠 + +
  • ); } @@ -76,10 +88,16 @@ export default function DocBreadcrumbs(): JSX.Element | null { styles.breadcrumbsContainer, )} aria-label="breadcrumbs"> -