# Loader

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

> Every page: https://tomekit.aayush.cv/llms.txt

Defined in: [index.ts:200](https://github.com/aayushbtw/tomekit/blob/main/packages/tomekit/src/index.ts#L200)

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

## Example

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

## Properties

### load

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

Defined in: [index.ts:202](https://github.com/aayushbtw/tomekit/blob/main/packages/tomekit/src/index.ts#L202)

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