We launched new forums in March 2019β€”join us there. In a hurry for help with your website? Get Help Now!
    • 22673
    • 72 Posts
    Hi,

    I am trying to keep class="active" on my main navigation whilst I am visiting a sub-page/child of a section.
    To expand, I have a top level page called "Fitness" in my main nav. This page has a number of sub-pages but when you visit one of them, "Fitness" in the main nav looses it’s class="active".

    I have friendly URLs with the alias path enabled so my urls look like: mydomain.com/fitness/fitness-programming

    My Wayfinder call for the main nav looks like:

    [[Wayfinder? &startId=`0` &level=`1` &hereTpl=`tplNavActive` &excludeDocs=`1` ]]


    tplNavActive looks like:

    <li>
    
        <a class="active">[+wf.linktext+]</a>
    
    </li>


    Any help would be much appreciated.
      • 28042 β˜† A M B β˜†
      • 24,524 Posts
      You might do better to use [+wf.classes+] and let Wayfinder insert its active class. By default it will insert class="active" in the active page and all its parents wherever that placeholder is used.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org