# defineLoader

Defines a loader outside a collection, eg one several collections share, with its file type inferred from the entries it returns.

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

```ts
function defineLoader<TFile extends FileInfo | undefined = undefined>(loader: Loader<TFile>): Loader<TFile>;
```

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

Defines a loader outside a collection, eg one several collections share, with its file type inferred from the entries it returns.

## Parameters

### loader

[`Loader`](https://tomekit.aayush.cv/api-tomekit/interfaces/Loader/index.md)`<TFile>`

## Returns

[`Loader`](https://tomekit.aayush.cv/api-tomekit/interfaces/Loader/index.md)`<TFile>`

## Example

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

export default defineConfig({
  collections: { pages: { loader: pages, schema: z.strictObject({}) } },
});
```
