Files
zitadel/apps/docs/app/api/search/route.ts
T
8ccd5b206f docs: migrate to native Fumadocs search & UI fixes (#12732)
Changes:

- **Search**: Replaced Inkeep with Fumadocs' native built-in search
(createFromSource). Removed @inkeep/cxkit-react and custom search
dialogs.

- **Hydration Fix**: Removed markdown links from ### headings in
egress.mdx (across all versions) to fix the <a inside a> DOM mismatch
error.

- **Console Fix**: Added the missing key prop to <VersionSelector/> in
the layout to resolve the React list warning.

---------

Co-authored-by: Florian Forster <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
2026-09-11 10:47:53 -07:00

33 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { getBreadcrumbItems } from 'fumadocs-core/breadcrumb';
import { createSearchAPI } from 'fumadocs-core/search/server';
import { source, versionSource } from '@/lib/source';
import { getVersionFromUrl, LATEST_VERSION } from '@/lib/versions';
// Both loaders share one index. Every entry is tagged with its docs version so the
// client can scope results to the version being viewed (see app/providers.tsx).
function indexPages(loader: typeof source | typeof versionSource, getTag: (url: string) => string) {
const tree = loader.getPageTree();
return loader.getPages().map((page) => ({
id: page.url,
url: page.url,
title: page.data.title,
description: page.data.description,
structuredData: page.data.structuredData,
// Sidebar path (e.g. "Deploy & Operate › Self-Hosted"), shown with each result.
breadcrumbs: getBreadcrumbItems(page.url, tree)
.map((item) => item.name)
.filter((name): name is string => typeof name === 'string'),
tag: getTag(page.url),
}));
}
export const { GET } = createSearchAPI('advanced', {
// https://docs.orama.com/docs/orama-js/supported-languages
language: 'english',
indexes: [
...indexPages(source, () => LATEST_VERSION),
...indexPages(versionSource, getVersionFromUrl),
],
});