content.navigation()
content.navigation(sources?)
Builds a hierarchical NavigationItem tree from the manifest, honouring numeric filename prefixes, .navigation.yml config files, and each document's data.navigation.
Parameters:
sources?: array of source names to include. Defaults to all.
Returns: Promise<NavigationItem[]>
const nav = await content.navigation(['content'])Files sort by stem; a directory with an index.md collapses into a single entry. A .navigation.yml overrides a directory's title/icon or hides it with navigation: false; a file's navigation.title shadows its title in the sidebar, and its own navigation: false keeps it out of the tree entirely.
The directory around an opted-out index.md stays as an unlinked group (page: false), but it is rebuilt from the siblings: it is titled after the directory name rather than the index page, and a directory holding nothing else disappears along with it. Give the group its own title through a .navigation.yml.
Usage
const nav = await content.navigation()