Function: directory()

function directory(folder: string, { exclude, include }?: DirectoryOptions): Loader<FileInfo>;

Defined in: directory.ts:66

Loads each Markdown file in a directory as an entry: its frontmatter is the metadata and the rest is the body.

The slug is the frontmatter's slug, or the file's path inside the directory without the extension, eg guides/setup.

Parameters

folder

string

Relative to the project root, eg content/posts.

{ exclude, include }?

DirectoryOptions

Returns

Loader<FileInfo>

Example

posts: {
  loader: directory("content/posts", { exclude: "drafts/**" }),
  schema: z.object({ title: z.string() }),
}