Source API
Turn a content source into an unified interface
Usage
Source API is a helper to load file-system based content source, it outputs numerous useful properties to integrate with Fumadocs, such as Page Tree.
Root Directory
All files outside of the root directory will be ignored.
Relative paths, like ./
and ../
are not supported.
Base URL
As the loader
function also generate an URL for each page, you can override the default base URL.
Icons
Load the icon property specified by pages and meta files.
Deep Dive
As mentioned, the output strictly follows Page Conventions. During the process, your input source files will be parsed and form a virtual storage to avoid inconsistent behaviour between different OS.
Transformer
To perform virtual file-system operations before processing, you can add a transformer.
Custom Source
To plug your own content source, return a Source
object.
It includes a files
property which has an array of virtual files.
Each virtual file must contain its file path and corresponding data.
Last updated on