Skip to content
qino

Since 0.1.0

getPreviousNode

The node before a slug in reading order.

Flattens the tree depth-first and returns the node before the given slug, or null at the start.

src/app/docs/[...slug]/page.tsx
const previous = await docsTree.getPreviousNode("guides/setup");
// TreeNode for "guides", or null

Signature

@qino/cms
tree.getPreviousNode(slug: Slug): Promise<TreeNode | null>;

Parameters

NameTypeRequiredDescription
slugstringyesSlug of the current node

Returns

Promise<TreeNode | null>. null when the slug is the first node.

Throws

  • Tree entry "<slug>" not found in tree "<directory>".
  • The walk errors listed on getTree.

See also