Since 0.1.0
getFlatTree
Return every node in depth-first reading order.
Walks the tree and flattens it depth-first, so a section comes right before its children.
const nodes = await docsTree.getFlatTree();
// introduction, guides, guides/setup, guides/deploy, faq
Signature
tree.getFlatTree(): Promise<Array<TreeNode>>;
Parameters
None.
Returns
Promise<Array<TreeNode>> in pre-order. Each node still carries its own children.
Throws
The same walk errors as getTree.
Example
export async function generateStaticParams() {
const nodes = await docsTree.getFlatTree();
return nodes.map((node) => ({ slug: node.slug.split("/") }));
}