1

I have what seems like a pretty straightforward Structure navigation menu, but for some reason, the entries that "Hide from Nav?" set to "Yes" are still displaying in the navigation.

Hide from Nav selected in channel entry

The page is even labelled as "(hidden)" in the Structure interface, but still it shows up in the navigation.

Structure Listing

Is there something wrong with my code?

<div class="nav-menu">
{exp:structure_entries depth="2" current_class="active"}
    {if {count} ==1}<ul id="top-nav" {if {current+child}==1}class="active" {/if}>{/if}
    {if {depth} == 1}
        {!-- Top Level --}
        <li>
            <a href="#">{title}</a>
        {if {children_total} == 0}{!-- No Children - so close markup --}</li>{/if}  
        {if:else}{!-- Children (not top level) --}
            {if {sibling_count} == 1}
                {!-- First child - so open markup --}
                <div class="subnav-dropdown">
                    <ul class="level{depth} subnav">
            {/if}
                        <li>
                            <a href="{page_uri}">{title}</a>
                            {close_markup}
                        {if {total_children} == 0 || {depth} == {restricted_depth}}</li>{/if}
                    {if {last_sibling} && {sibling_count} == {sibling_total}}
                    </ul>
                </div>
        </li>{/if}
        {/close_markup}{/if}
    {if {count}=={total_results}}</ul>{/if}
{/exp:structure_entries}
</div>
1

I'll hazard a guess here and say that the reason your "Hidden from Nav" entries are being output is because you're not actually using a Structure module tag, but the Structure Entries plugin.

I'm not sure what kind of support Structure Entries has for Structure's Hidden from Nav feature. What version are you using? It sounds like there is a beta version that has a hide_from_nav="yes" parameter. There is a link to the beta v1.3.4 on its devotee page.

This Structure Entries support thread might also help.

A possible alternative would be to switch your template to use the Structure module's {exp:structure:nav} tag or another of the Structure module's tags.

| improve this answer | |
  • This was the only way I knew of to make the dynamic dropdown navigation work. I tried using the exclude parameter, and that didn't work either. – Ty Morton Jan 30 '15 at 16:11
  • What version of the Structure Entries plugin are you using? – Alex Kendrick Jan 30 '15 at 16:11
  • The 1.3.4 beta version solved the problem for me. Thanks, Alex! – Ty Morton Jan 30 '15 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.