Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getActiveNode not working #408

Open
clintonbeattie opened this issue Nov 6, 2024 · 1 comment
Open

getActiveNode not working #408

clintonbeattie opened this issue Nov 6, 2024 · 1 comment

Comments

@clintonbeattie
Copy link

Describe the bug

This is a common setup that I use so I am very familiar with it but for some reason the getActiveNode is empty. I have tried using {{ dump(nodeActive)}} and nothing is ouput.

{% set headerNavigationNodes = craft.navigation.nodes('headerNavigation').level(1).all() %}
{% set nodeActive = craft.navigation.getActiveNode({ handle: 'headerNavigation' }, true) %}

<nav>
    <ul id="main-navigation" class="main-nav hide-lt-xl">
        {% for node in headerNavigationNodes %}
            <li class=""><a href="{{ node.url }}" class="{% if nodeActive == node.title %} is-active{% endif %}">{{ node.title }}</a></li>
        {% endfor %}
    </ul>
</nav>

Steps to reproduce

Craft CMS version

4.12.8

Plugin version

2.1.1

Multi-site?

No

Additional context

No response

@engram-design
Copy link
Member

Seems to be okay for me! What sort of node is the one you're checking against to see if it's active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants