Skip to content
qino

Since 0.1.0

getEntry

Read one node's content by slug.

Reads a single file by slug, validates it, and applies the selected view.

src/app/docs/[...slug]/page.tsx
const entry = await docsTree.getEntry("guides/setup");
entry.title;
entry.markdown;
entry._meta.slug; // "guides/setup"

Signature

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

Parameters

NameTypeRequiredDefaultDescription
slugstringyesSlash-joined path minus extension, such as guides/setup
options.viewview nameno"default"A view declared in views

Returns

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

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.

See also