---
title: "ContentBuilder"
description: "The builder `createContent` hands to its callback."
url: "https://pitlane.tools/package/content/interface/ContentBuilder"
---

# ContentBuilder

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

The builder `createContent` hands to its callback.

## Methods

### collection()

```ts
collection<S>(input): CollectionDefinition<S>;
```

Declares one collection: where its entries come from and the schema each must satisfy.

#### Type Parameters

##### S

`S` _extends_ [`StandardSchemaV1`](https://standardschema.dev)\<`unknown`>

#### Parameters

##### input

###### loader

[`Loader`](https://pitlane.tools/package/content/type/Loader.md)

###### schema

`S`

#### Returns

[`CollectionDefinition`](https://pitlane.tools/package/content/interface/CollectionDefinition.md)\<`S`>

---

### reference()

```ts
reference<C>(collection): ReferenceSchema<C>;
```

A schema for a field holding the id of an entry in `collection`, which parses to a [Reference](https://pitlane.tools/package/content/interface/Reference.md) that collection's `getEntry` accepts.

#### Type Parameters

##### C

`C` _extends_ `string`

#### Parameters

##### collection

`C`

#### Returns

[`ReferenceSchema`](https://pitlane.tools/package/content/type/ReferenceSchema.md)\<`C`>
