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"- transform(entry: { data: output<Schema>; file: FileInfo; }, globalConfig?: GlobalConfig | undefined) => TransformOutput | Promise<...>- dirstring | string[]- filesstring[]- schemaSchema | ((ctx: TransformContext) => Schema)- -
type: docMarkdown/MDX Documents, available options:
Prop Type Default type"doc"- transform(entry: { data: output<Schema>; file: FileInfo; mdx: Async extends true ? MarkdownProps : never; }, globalConfig?: GlobalConfig | undefined) => TransformOutput | Promise<...>- mdxOptionsMDXOptions- asyncAsync- dirstring | string[]- filesstring[]- schemaSchema | ((ctx: TransformContext) => Schema)-
dir
Directories to scan input files.
schema
The Zod schema to validate file data (frontmatter on doc type, content on meta type).
You can add additional properties to the output. 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
You can use defineDocs to define the required collections to work with Fumadocs.
It offers the same API as defineCollections.
The docs and meta are collections on their own.
You can pass collection options to them as shown above.
dir
Instead of per collection, you should customise dir from defineDocs:
schema
You can extend the default Zod schema of docs and meta.
Last updated on
