Skip to content

getActiveNode includeChildren #418

@svondervoort

Description

@svondervoort

Describe the bug

When using craft.navigation.getActiveNode({ handle: 'headerMain' }, true) this isn't matching the children for some reason.

We have this navigation structure:

  • /markets
    • /markets/some-page
  • /insights
    • /insights/some-page (not in nav)

When setting the includeChildren to true and visiting /markets/some-page it will return the /markets as the activeNode instead of /markets/some-page. Instead in our case it should return both.

When looking at the docs I understand you have to set includeChildren to true in case pages are not in your navigation but an overview page is. But in our navigation we have cases where some children are in the navigation and others are only a child by URL.

Steps to reproduce

  1. Create a structured section with at least 2 levels
  2. Create nested entries within that section
  3. Create a navigation with the same nested structure
  4. Get the activeNode with includeChildren set to true

Craft CMS version

5.6.11

Plugin version

3.0.6

Multi-site?

No

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions