Interface: Loader

View as Markdown

Defined in: index.ts:200

Where a collection's entries come from. directory reads files; write your own to load entries from code, eg an API.

Example

const pages: Loader = {
  load: () => ({
    entries: [{ body: "# Hello", metadata: { title: "Hello" }, slug: "hello" }],
  }),
};

Properties

load

load: (context: LoadContext) => LoadResult<TFile> | PromiseLike<LoadResult<TFile>>;

Defined in: index.ts:202

Runs on every build, and in dev again when the config or a file it watches changes. Throwing fails the whole collection.