Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ export default function RootLayout({
{/* Global animated backgrounds (sky / stars) */}
<div className="site-bg site-bg--sky" aria-hidden />
<div className="site-bg site-bg--stars" aria-hidden />
<RootProvider>
<RootProvider
search={{
// Use static index so it works in `next export` and dev.
options: {
type: "static",
api: "/search.json",
},
}}
>
{children}
<ThemeProvider defaultTheme="system" storageKey="ih-theme">
<div className="relative z-10">{children}</div>
</ThemeProvider>
Expand Down
18 changes: 18 additions & 0 deletions app/search.json/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createFromSource } from "fumadocs-core/search/server";
import { source } from "@/lib/source";
import { createTokenizer } from "@orama/tokenizers/mandarin";

// Ensure this route is statically generated during `next export`.
export const dynamic = "force-static";

// Static search database for static export (Next.js `output: "export"`).
const api = createFromSource(source, {
components: {
tokenizer: createTokenizer(),
},
search: {
threshold: 0.3,
tolerance: 1,
},
});
export const GET = api.staticGET;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"migrate:images": "node scripts/move-doc-images.mjs"
},
"dependencies": {
"@orama/orama": "^3.1.13",
"@orama/tokenizers": "^3.1.13",
"@types/mdx": "^2.0.13",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
Expand Down
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.