Installation
Setup
1. Configure Content Collections
Create acontent-collections.ts file:
content-collections.ts
2. Create Your Source
Create a source file that uses the Content Collections adapter:lib/source.ts
3. Build Integration
Add Content Collections to your build process:Schema Configuration
Document Schema
Customize the frontmatter schema for your documents:content-collections.ts
frontmatterSchema includes:
Meta Schema
Customize the meta.json schema:content-collections.ts
metaSchema includes:
Transform Options
ThetransformMDX function accepts options to customize MDX processing:
content-collections.ts
Plugin Customization
You can customize individual plugins:Output Types
ThetransformMDX function returns:
Using Helper Functions
The adapter provides helper functions for creating schemas:content-collections.ts
Creating the Source
UsecreateMDXSource to convert Content Collections to a Fumadocs source:
lib/source.ts
createMDXSource function expects:
- First parameter: Array of document entries with
_meta.filePath - Second parameter: Array of meta entries with
_meta.filePath
Usage in Your App
Once configured, use the source in your application:app/docs/[[...slug]]/page.tsx
Multiple Collections
You can define multiple documentation collections:content-collections.ts
lib/source.ts
Comparison with Fumadocs MDX
| Feature | Fumadocs MDX | Content Collections |
|---|---|---|
| Configuration | source.config.ts | content-collections.ts |
| Type Generation | Automatic | Via Content Collections |
| Build Performance | Optimized for Fumadocs | Content Collections engine |
| Plugin System | Fumadocs plugins | Content Collections transforms |
| Hot Reload | Yes | Yes |
| Async Loading | Built-in | Via transforms |
| Workspaces | Native support | Manual setup |
Migration to Fumadocs MDX
If you want to migrate to the native Fumadocs MDX:- Create a
source.config.tsfile - Convert your collections to
defineDocsordefineCollections - Update imports from
content-collectionstofumadocs-mdx:collections/server - Replace
createMDXSourcewithdocs.toFumadocsSource() - Update your build integration