From e36d3a86871b2d0a0699328ee3cd0f36c4e546e8 Mon Sep 17 00:00:00 2001 From: RadAlpaca11 Date: Thu, 27 Aug 2026 11:02:20 -0700 Subject: [PATCH 1/3] feat: adding search whole docs on home page --- src/app/(home)/layout.tsx | 6 +----- src/app/global.css | 11 +++++++++++ src/components/search.tsx | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/(home)/layout.tsx b/src/app/(home)/layout.tsx index 85beb85..b8b904e 100644 --- a/src/app/(home)/layout.tsx +++ b/src/app/(home)/layout.tsx @@ -2,9 +2,5 @@ import { HomeLayout } from "fumadocs-ui/layouts/home"; import { baseOptions } from "@/lib/layout.shared"; export default function Layout({ children }: LayoutProps<"/">) { - return ( - - {children} - - ); + return {children}; } diff --git a/src/app/global.css b/src/app/global.css index b88fee4..22f8c68 100644 --- a/src/app/global.css +++ b/src/app/global.css @@ -68,3 +68,14 @@ body { "sidebar . toc-popover toc ." "sidebar . main toc ." !important; } + +#nd-home-layout #nd-nav [class*="max-w-(--fd-layout-width)"] { + max-width: none; + margin-inline-start: 0; + padding-inline-start: 1.5625rem; +} + +#nd-sidebar a[href="/"] { + align-self: flex-start; + margin-top: -0.625rem; +} diff --git a/src/components/search.tsx b/src/components/search.tsx index def2736..ebe798f 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -32,7 +32,7 @@ export default function DefaultSearchDialog(props: SharedProps) { client: oramaStaticClient({ initOrama, locale, - from: repo ? `/api/search/${repo}` : undefined, + from: repo ? `/api/search/${repo}` : "/api/search", }), delayMs: 100, }); From 2266b4f4422ebb7e97f9500517b90af2b3f55067 Mon Sep 17 00:00:00 2001 From: RadAlpaca11 Date: Thu, 27 Aug 2026 11:04:27 -0700 Subject: [PATCH 2/3] feat: whole docs search --- src/app/api/search/route.ts | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/app/api/search/route.ts diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts new file mode 100644 index 0000000..6b990c9 --- /dev/null +++ b/src/app/api/search/route.ts @@ -0,0 +1,53 @@ +import { getRepoMeta, getSource, repoIds } from "@/lib/source"; +import { createSearchAPI, type AdvancedIndex } from "fumadocs-core/search/server"; + +// Combined cross-repo search index for the home page + +export const revalidate = false; + +interface SearchPageData { + title?: string; + description?: string; + structuredData?: unknown; + load?: () => Promise<{ structuredData: unknown }>; +} + +async function buildIndexes(): Promise { + const indexes: AdvancedIndex[] = []; + + for (const repoId of repoIds) { + const source = getSource(repoId); + if (!source) continue; + const repoName = getRepoMeta(repoId)?.name ?? repoId; + + const pages = source.getPages() as { data: SearchPageData; url: string }[]; + for (const page of pages) { + let structuredData = page.data.structuredData; + if (typeof structuredData === "function") structuredData = await structuredData(); + if (!structuredData && typeof page.data.load === "function") { + structuredData = (await page.data.load()).structuredData; + } + if (!structuredData) continue; + + indexes.push({ + id: page.url, + url: page.url, + title: page.data.title ?? page.url, + description: page.data.description, + breadcrumbs: [repoName], + tag: repoId, + structuredData: structuredData as never, + }); + } + } + + return indexes; +} + +export async function GET() { + const { staticGET } = createSearchAPI("advanced", { + indexes: buildIndexes, + language: "english", + }); + return staticGET(); +} From 77b08f0f2e58bb0a6c5bef639f742881cb6eacad Mon Sep 17 00:00:00 2001 From: RadAlpaca11 Date: Thu, 27 Aug 2026 11:10:38 -0700 Subject: [PATCH 3/3] fix: fixing routes for search --- src/app/api/{search => search-all}/route.ts | 0 src/components/search.tsx | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/app/api/{search => search-all}/route.ts (100%) diff --git a/src/app/api/search/route.ts b/src/app/api/search-all/route.ts similarity index 100% rename from src/app/api/search/route.ts rename to src/app/api/search-all/route.ts diff --git a/src/components/search.tsx b/src/components/search.tsx index ebe798f..922a589 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -32,7 +32,7 @@ export default function DefaultSearchDialog(props: SharedProps) { client: oramaStaticClient({ initOrama, locale, - from: repo ? `/api/search/${repo}` : "/api/search", + from: repo ? `/api/search/${repo}` : "/api/search-all", }), delayMs: 100, });