Fumadocs rebuilt on Hamur, the original is fumadocs.dev
Skip to Content
Fumadocs

Server Entry

Accessing collection outputs from server.

Usage

While you can access the collections directly from entry file, we suggest using it with loader().

import { docs } from 'collections/server';
import { loader } from 'fumadocs-core/source';

// raw collection
console.log(docs);

export const source = loader({
  baseUrl: '/docs',
  source: docs.toFumadocsSource(),
});

Examples

import { source } from '@/lib/source';

const page = source.getPage(['slugs']);

if (page) {
  // access page data
  console.log(page.data);

  // frontmatter properties are also available
  console.log(page.data.title);
}

To render the page (on RSC), use page.data.body as a component.

import { getMDXComponents } from '@/components/mdx';

const MDX = page.data.body;

// set your MDX components with `components` prop
return <MDX components={getMDXComponents()} />;

How is this guide?

Last updated on