-
I have a /blog and /docs, how can I make the search only return results relevant for the specific page? I only know how to change the search results globally, but not individually.
import { docs, meta } from '@/.source';
import { createMDXSource } from 'fumadocs-mdx';
import { loader } from 'fumadocs-core/source';
import { blogPosts } from '@/.source';
export const source = loader({
baseUrl: '/docs',
source: createMDXSource(docs, meta)
});
export const blog = loader({
baseUrl: '/blog',
source: createMDXSource(blogPosts, [])
});
import { source } from '@/lib/source';
import { createFromSource } from 'fumadocs-core/search/server';
export const { GET } = createFromSource(source); // can change to blog but will also affect /docs |
Beta Was this translation helpful? Give feedback.
Answered by
KamilDev
Jan 5, 2025
Replies: 1 comment 4 replies
-
If you want to merge the two sources into a single search route, you can pass by index: https://fumadocs.vercel.app/docs/headless/search/orama#from-search-indexes |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this a good approach?
By the way, is the
RootProvider
search optionapi
field in the documentation? I could not find it when loo…