From 60a187eb2679681a38a06c0a5077991a5d201855 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Mon, 17 Nov 2025 19:34:13 +0100 Subject: [PATCH] Exclude "See also" sections from search --- docusaurus.config.ts | 1 + src/theme/DocCard/index.tsx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 94b22190fb..a84771a782 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -100,6 +100,7 @@ const config: Config = { { indexBlog: false, docsRouteBasePath: '/', + ignoreCssSelectors: '.exclude-from-search', } satisfies import('@easyops-cn/docusaurus-search-local').PluginOptions, ], ], diff --git a/src/theme/DocCard/index.tsx b/src/theme/DocCard/index.tsx index bfc12fa734..718923cdcb 100644 --- a/src/theme/DocCard/index.tsx +++ b/src/theme/DocCard/index.tsx @@ -38,14 +38,16 @@ function useCategoryItemsPlural() { function CardContainer({ href, children, + className, }: { href: string; children: ReactNode; + className?: string; }): ReactNode { return ( + className={clsx('card padding--lg', styles.cardContainer, className)}> {children} ); @@ -57,15 +59,17 @@ function CardLayout({ title, description, customProps, + className, }: { href: string; icon: ReactNode; title: string; description?: string; customProps: {[key: string]: unknown} | undefined; + className?: string; }): ReactNode { return ( - + ); } -function CardLink({item}: {item: PropSidebarItemLink}): ReactNode { +function CardLink({item, className}: {item: PropSidebarItemLink, className?: string}): ReactNode { const icon = isInternalUrl(item.href) ? '📄️' : '🔗'; const doc = useDocById(item.docId ?? undefined); return ( @@ -123,6 +128,7 @@ function CardLink({item}: {item: PropSidebarItemLink}): ReactNode { title={item.label} description={item.description ?? doc?.description} customProps={item.customProps} + className={className} /> ); } @@ -130,9 +136,9 @@ function CardLink({item}: {item: PropSidebarItemLink}): ReactNode { export default function DocCard({item}: Props): ReactNode { switch (item.type) { case 'link': - return ; + return ; case 'category': - return ; + return ; default: throw new Error(`unknown item type ${JSON.stringify(item)}`); }