mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
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]>
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
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),
|
||
],
|
||
});
|