Interface: CollectionConfig

Defined in: index.ts:246

One collection: where its entries come from, how to validate them and what to return.

Properties

loader

loader: Loader<TFile>;

Defined in: index.ts:252

Where the entries come from, eg directory("content/posts").


schema

schema: TSchema;

Defined in: index.ts:254

Validates each entry's metadata, and must produce an object. A file without frontmatter is validated as {}.

Methods

transform()

transform?(source: Source<InferOutput<TSchema>, TFile>, context: TransformContext): TOutput | PromiseLike<TOutput>;

Defined in: index.ts:270

Changes each document at build time. Return a new metadata and/or body, and their types become the document's. Return data only: plain objects, arrays, primitives, Date, Map, Set, URL or RegExp.

transform: ({ body, metadata, slug }) => ({
  body: marked.parse(body, { async: false }),
  metadata: { ...metadata, url: `/posts/${slug}` },
})