Generate Search Indexes

Integrate with search solutions seamlessly

Usage

Add buildSearchIndex to options.

import createMDX from 'fumadocs-mdx/config';

/** @type {import('next').NextConfig} */
const config = {
  reactStrictMode: true,
};

const withMDX = createMDX({
  buildSearchIndex: {}, 
});

export default withMDX(config);

After running next build, generated search indexes will be written to .next/server/chunks/fumadocs_search.json. You can access them with JSON.parse.

update-index.mts
import { readFileSync } from 'node:fs';
import type { SearchIndex } from 'fumadocs-mdx';

const indexes = JSON.parse(
  readFileSync('./.next/server/chunks/fumadocs_search.json').toString(),
) as SearchIndex[];

Options

PropTypeDefault

Last updated on

On this page