Interface: Source

Defined in: index.ts:58

A document before transform: its metadata as the schema produced it, and the entry's body.

Example

// One transform shared by several collections
function withUrl<TMetadata extends object>(
  { metadata, slug }: Source<TMetadata>,
  { collection }: TransformContext
) {
  return { metadata: { ...metadata, url: `/${collection}/${slug}` } };
}

Properties

body

body: string;

Defined in: index.ts:63

The entry's body, eg a file's text after the frontmatter block.


file

file: TFile;

Defined in: index.ts:65

Where the entry's file lives, or undefined when its loader gave none.


metadata

metadata: TMetadata;

Defined in: index.ts:67

The entry's metadata, as the collection's schema produced it.


slug

slug: string;

Defined in: index.ts:69

The document's key in its collection, eg guides/setup.