Collections
Collection of content data for your app
Define Collections
Define a collection to parse a certain set of files.
type
The accepted type of collection.
-
type: metaAccept JSON/YAML Files, available options:
Prop Type Default type"meta"- schemaCollectionSchema<Schema, { path: string; source: string; }>- dirstring | string[]- filesstring[]- -
type: docMarkdown/MDX Documents, available options:
Prop Type Default type"doc"- mdxOptionsMDXOptions- asyncAsync- schemaCollectionSchema<Schema, { path: string; source: string; }>- dirstring | string[]- filesstring[]-
dir
Directories to scan input files.
schema
The schema to validate file data (frontmatter on doc type, content on meta type).
Standard Schema compatible libraries, including Zod are supported.
Note that the validation is done by build time, hence the output must be serializable. You can also pass a function and receives the transform context.
mdxOptions
Customise MDX options on collection level.
By design, this will remove all default settings applied by your global config and Fumadocs MDX. You have full control over MDX options.
You can use getDefaultMDXOptions to apply default configurations, it accepts the extended MDX Options.
This API only available on doc type.
Define Docs
Define a collection for Fumadocs.
dir
Instead of per collection, you should customise dir from defineDocs:
schema
You can extend the default Zod schema of docs and meta.
