Context
A NavigationContext describes the current page’s position in a menu. Obtain it in Twig with craft.navigation.context('mainMenu'), or pass node criteria as a second argument: craft.navigation.context('mainMenu', { siteId: currentSite.id }).
The current node is the deepest exact URL match and can be a stored Node or a ProjectedNode. See Build a Section Sidebar for a complete use case.
Methods
Deepest exact-match node
All exact matches, deepest first
All branch-active nodes
Parent of deepest current node
Root → parent of current
Same-level nodes under shared parent
Direct children of deepest current node
Ancestors + current + siblings (common sidebar set)
When no node exactly matches the request URL, current() and parent() return null; methods based on that current node return empty arrays. activeNodes() can still contain path-active nodes. Supplying criteria does not replace the request URL used for matching.