From f9ba304888933897588ce49160a7677ff5d2f226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Fri, 28 Nov 2025 10:56:45 +0100 Subject: [PATCH 1/2] feat(theme-search-algolia): allow overriding transformSearchClient --- .../src/theme/SearchBar/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx index 103153260bc8..4072a7000076 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -67,6 +67,10 @@ interface DocSearchV4Props extends Omit { translations?: DocSearchTranslations; } +type SearchBarProps = Partial< + Pick +>; + let DocSearchModal: typeof DocSearchModalType | null = null; function importDocSearchModalIfNeeded() { @@ -312,9 +316,12 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) { ); } -export default function SearchBar(): ReactNode { +export default function SearchBar(props: SearchBarProps): ReactNode { const {siteConfig} = useDocusaurusContext(); return ( - + ); } From b625a0efbedf5343111c02a55555d5c3c52783f7 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 5 Dec 2025 18:10:26 +0100 Subject: [PATCH 2/2] minor refactor --- .../src/theme/SearchBar/index.tsx | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx index 4072a7000076..cf681939b143 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -67,10 +67,6 @@ interface DocSearchV4Props extends Omit { translations?: DocSearchTranslations; } -type SearchBarProps = Partial< - Pick ->; - let DocSearchModal: typeof DocSearchModalType | null = null; function importDocSearchModalIfNeeded() { @@ -316,12 +312,15 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) { ); } -export default function SearchBar(props: SearchBarProps): ReactNode { +export default function SearchBar(props: Partial): ReactNode { const {siteConfig} = useDocusaurusContext(); - return ( - - ); + + const docSearchProps: DocSearchV4Props = { + ...(siteConfig.themeConfig.algolia as DocSearchV4Props), + // Let props override theme config + // See https://github.com/facebook/docusaurus/pull/11581 + ...props, + }; + + return ; }