Change Linklists in main navigation based on what page, product or collection you're on

Highlighted
Shopify Partner
14 0 1

I'm trying to make some changes in Shopify's Debut theme where depending on the page, collection, or product you're on, the navigation changes to reflect that alteration. In other words, different linklists should appear.

I've come up with this series of if statements using the request.path object. Now that works, but it's getting the code to display the proper linklist to appear that's the problem.

So het's say I have 'menu2' as my handle for the second menu I want to see. This would be code i currently have in header.liquid

{% if section.settings.align_logo == 'center' and request.page_type == 'index' %}
<nav class="grid__item medium-up--one-third small--hide" id="AccessibleNav" role="navigation">
{% include 'site-nav', linklist: section.settings.main_linklist, wrapper_class: 'site-nav--centered' %}
</nav>
{% elsif section.settings.align_logo == 'center' and request.path == '/pages/page2' or request.path == '/collections/collection2' %}
<nav class="grid__item medium-up--one-third small--hide" id="AccessibleNav" role="navigation">
{% include 'site-nav', linklist.menu2, wrapper_class: 'site-nav--centered' %}
</nav>
{% endif %}

 

0 Likes