# CollectionConfig

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

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

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

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

## Properties

### loader

```ts
loader: Loader<TFile>;
```

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

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

***

### schema

```ts
schema: TSchema;
```

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

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

## Methods

### transform()

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

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

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`.

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