Returns a flat NodeData[] array containing every node slugtree knows about, including both pages and folders. The order follows the tree traversal used during generation.

import { getAllNodes } from 'slugtree'

const nodes = getAllNodes()

Return value

Returns NodeData[]. Both type === 'page' and type === 'folder' entries are included. Label nodes are not present in the flat list — they only appear in the tree structure returned by getTree().

Usage

Filter by type when you need only one category:

import { getAllNodes } from 'slugtree'

const nodes = getAllNodes()

const folders = nodes.filter((n) => n.type === 'folder')
const pages = nodes.filter((n) => n.type === 'page')

If you only need pages (excluding folders), use getPageNodes() instead — it's a direct shorthand. If you need to filter by a custom condition, prefer findNodes(). For client components, use useAllNodes().