Skip to content

Since 0.3.0

getEntry

Read the item's file.

View Markdown
On this page

Reads the item's file, validates it, and applies the selected view.

src/app/page.tsx
const home = await homeItem.getEntry();
home.title;
home["featured-posts"][0].title; // resolved by the default view
home._meta.fileName; // "home.md"

Signature

@qino/cms
item.getEntry(options?: { view?: ViewName }): Promise<Entry>;

Parameters

Returns

Promise<Entry>: the schema output, _meta (fileName, filePath, no slug), resolved relations at the view's depth, and the awaited augment output.

Throws

  • A raw ENOENT error from Node when the file does not exist.
  • Unknown view "<name>". Available views: <names>.
  • Getter option errors, validation, relation, and augment errors. See Errors.