1

I have a separate navigation that I want displayed on all pages that are not the home page.

I thought something link this would work but not quite:

{if segment_1}
{if:else}
<nav class="main-nav">
<a class="active" href="/">Home</a>
<a href="allergies.html">Allergies</a>
<a href="about.html">About</a>
<a href="services.html">Services</a>
<a href="locations.html">Locations</a>
<a href="contact.html">Contact</a>
</nav>
{/if}

Any help appreciated.

N

1

This works:

{if segment_1}
<nav class="main-nav">
<a class="nav-one" href="{path='site_index'}">Home</a>
<a class="nav-two" href="{path='allergies'}">Allergies</a>
<a class="nav-three" href="{path='about'}">About</a>
<a class="nav-four" href="{path='services'}">Services</a>
<a class="nav-five" href="{path='locations'}">Locations</a>
<a class="nav-six" href="{path='contact'}">Contact</a>
</nav>

{if:else}
{/if}
| improve this answer | |
1

Testing against a specific value seems to work more consistently in EE. So you could test if segment_1 is not empty:

{if segment_1 != ""}
    Not the home page
{if:else} 
    The home page
{/if}

or test that segment_1 is empty

{if segment_1 == ""}
    The home page
{if:else} 
    Not the home page
{/if}
| improve this answer | |

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