Resetting variable while cycling through nav menu

I created a blueprint for pages which allows users to define an alternative title for the navigation menu, so they can have a page title (say, "Welcome to Xxxx!"), but then show this page as, say, "Home" in the navigation menu.

I'm using this code to create the navigation menu:

<nav class="nav-menu d-none d-lg-block">
  <ul>
    {{ nav:nav_menu include_home="true" is_hidden:isnt="true" }}
      {{ if children }}
       {{ if alt_nav_menu_title }}
         <li class="drop-down"><a href="">{{ nav_menu_title }}</a>
       {{ else }}
         <li class="drop-down"><a href="">{{ title }}</a>
       {{ endif }}
       <ul>
       {{ children }}
         {{ if alt_nav_menu_title }}
           <li><a href="{{ url }}">{{ nav_menu_title }}</a></li>
         {{ else }}
           <li><a href="{{ url }}">{{ title }}</a></li>
         {{ endif }}
       {{ /children }}
         </ul>
         </li>
       {{ else }}
         {{ if alt_nav_menu_title }}
           <li><a href="{{ url }}">{{ nav_menu_title }}</a></li>
         {{ else }}
           <li><a href="{{ url }}">{{ title }}</a></li>
         {{ endif }}
       {{ endif }}
    {{ /nav:nav_menu }}
  </ul>
</nav>

The thing is that the alt_nav_menu_title variable isn't reset to 'false' with each loop, so as soon as one page has it set to 'true', it retains that value for all subsequent pages, even if this variable is set to 'false' (toggle disabled) for those pages. That means that the defined alternative menu title (say, "Home") is shown in places in the nav menu where it shouldn't.

Is there a way to reset a variable (to 'false' in this case) between loops while cycling through a collection, such as a navigation menu, so each entry is parsed "fresh"?

Thanks! --Ron

>>>>>>> Unanswered <<<<<<<
0 Replies
1 Follower