docs: integrate search functionality with new SearchDialog component

- Added a new SearchDialog component to enhance user experience for searching documentation.
- Updated the layout to include the SearchDialog within the RootProvider for improved accessibility.
- Enhanced the search API to support tag filtering based on the first slug, allowing for more refined search results.
This commit is contained in:
Mauricio Siu
2025-12-07 18:11:04 -06:00
parent 4f685a2df9
commit b605ad10e3
3 changed files with 76 additions and 1 deletions

View File

@@ -1,7 +1,21 @@
import { source } from '@/lib/source';
import { createFromSource } from 'fumadocs-core/search/server';
import type { InferPageType } from 'fumadocs-core/source';
export const { GET } = createFromSource(source, {
// https://docs.orama.com/docs/orama-js/supported-languages
language: 'english',
// Configure tag filter based on the first slug (core, cli, api)
buildIndex(page: InferPageType<typeof source>) {
const tag = page.slugs[0] || 'all';
return {
title: page.data.title,
description: page.data.description,
url: page.url,
id: page.url,
structuredData: page.data.structuredData,
// Assign tag based on the first slug (core, cli, api)
tag,
} as any;
},
});