カスタム検索
その他の検索ソリューションを利用する場合の設定です。
概要
Fumadocs には、任意の検索エンジンを統合できます。
検索インデックス
Fumadocs MDX は、ページの検索インデックスをランタイムに公開します。
これらを静的にエクスポートするには、事前レンダリングされる static.json ルートを追加し、ビルドのたびにスクリプトでそのレコードを処理してください。
import { source } from '@/lib/source';
async function getDocuments() {
const documents = [];
for (const page of source.getPages()) {
documents.push({
structured: await page.data.structuredData(),
url: page.url,
title: page.data.title,
description: page.data.description,
});
}
return documents;
}
export async function GET() {
return Response.json(await getDocuments());
}
export async function getConfig() {
return {
render: 'static' as const,
} as const;
}
structured フィールドには、各ページの見出しと段落が格納されています。これを使って、精度の高い検索インデックスを生成してください。
How is this guide?
最終更新日
