Displaying alternative navigation menus on specific pages

kflora
Visitor
2 0 0

I have two pages that need to have an alternative navigation menu for google ad purposes. I thought it would be as simple as plugging in some if/else logic in the header.liquid file but I am running in to some issues. This is what I have tried and doesn't seem to be working: 

 {% if template == "product.name" %}
          {% include 'alt-nav' %}
          {% else %}
          {% include 'main-nav' %}
          {% endif %}

 

Replies 3 (3)

MandasaTech
Shopify Expert
723 146 153

Hello @kflora,
Please share your website URL.

☞ Helpful or Question answered? Please Click Like & Mark it Accepted Solution
☞ Want to modify or custom changes on store for affordable price? Click on Contact button here
☞ Email at info@mandasa.in
☞ Whatsapp at +918989609120 | Hire us at: Website Support Page

kflora
Visitor
2 0 0

Please let me know if anyone sees where I went wrong with this code! 

laylinessteve
Visitor
1 0 0
  1. find your `header-group.json` file and make a copy of it called `header-group-2`
  2. In the Dawn theme go to your `theme.liquid file`.  Find where your menu is rendered with {% section 'header-group' %}
  3. Replace that with this

    {% if template_contains_NAME_OF_YOUR_PAGE_TEMPLATE %}
    {% sections 'header-group-2' %}
    {% else %}
    {% sections 'header-group' %}
    {% endif %}

  4. Go to you theme editor and you can control which menu you want to appear on the page specified.