---
title: "ContentLoader"
description: "A loader that resolves a whole collection by filling a store."
url: "https://pitlane.tools/package/content/interface/ContentLoader"
---

# ContentLoader

```ts
import type { ContentLoader } from "@pitlane/content";
```

A loader that resolves a whole collection by filling a store.

Its shape is the claim that one execution produces the complete answer, which is what lets `contentLayer()` run it during the build and inline the result.

## Properties

### name

```ts
name: string;
```

## Methods

### load()

```ts
load(context): void | Promise<void>;
```

Reads the whole source and writes every entry through `context.store.set`. Runs on the collection's first read, or at build time under `contentLayer()`, and the result is kept for every read after it.

#### Parameters

##### context

[`LoaderContext`](https://pitlane.tools/package/content/interface/LoaderContext.md)

#### Returns

`void` | `Promise`\<`void`>

---

### watchedPaths()?

```ts
optional watchedPaths(): string[];
```

The files or directories the last `load` read, for a development host to watch. Omit it, or return nothing, for a source with no local files.

#### Returns

`string`\[\]
