Shopify themes, liquid, logos, and UX
Follow these steps to configure different header menus (header-mega-menu, header-dropdown-menu, header-drawer) based on different page templates and collections in your Shopify store.
In each of the files listed above, locate the beginning of the file.
Insert the following code at the top of each file to handle different templates:
Replace "collectiontemplate" with the page or collection page assigned name, found on the top of the editor.
{% if template.suffix == "collectiontemplate1" or
template.suffix == "collectiontemplate2" or
template.suffix == "collectiontemplate3" or
template.suffix == "collectiontemplate4" or
template.suffix == "collectiontemplate5" or
template.suffix == "collectiontemplate6" or
template.suffix == "collectiontemplate7" %}
{% assign _new_menu = linklists.handle.links %}
{% else %}
{% assign _new_menu = section.settings.menu.links %}
{% endif %}
In each file, locate the loop that iterates over the menu links. It might look something like this:
{%- for link in section.menu.links -%}
Replace that line with the following to use the newly assigned _new_menu:
{%- for link in _new_menu -%}
This approach allows you to tailor your site's navigation experience based on the content or design of individual pages and collections, enhancing usability and design consistency.
Example:
Solved! Go to the solution
This is an accepted solution.
Follow these steps to configure different header menus (header-mega-menu, header-dropdown-menu, header-drawer) based on different page templates and collections in your Shopify store.
In each of the files listed above, locate the beginning of the file.
Insert the following code at the top of each file to handle different templates:
Replace "collectiontemplate" with the page or collection page assigned name, found on the top of the editor.
{% if template.suffix == "collectiontemplate1" or
template.suffix == "collectiontemplate2" or
template.suffix == "collectiontemplate3" or
template.suffix == "collectiontemplate4" or
template.suffix == "collectiontemplate5" or
template.suffix == "collectiontemplate6" or
template.suffix == "collectiontemplate7" %}
{% assign _new_menu = linklists.handle.links %}
{% else %}
{% assign _new_menu = section.settings.menu.links %}
{% endif %}
In each file, locate the loop that iterates over the menu links. It might look something like this:
{%- for link in section.menu.links -%}
Replace that line with the following to use the newly assigned _new_menu:
{%- for link in _new_menu -%}
This approach allows you to tailor your site's navigation experience based on the content or design of individual pages and collections, enhancing usability and design consistency.
Example:
Thank you, but I just posted the solution to the problem. I think I posted on the wrong place :-V
This is an accepted solution.
Follow these steps to configure different header menus (header-mega-menu, header-dropdown-menu, header-drawer) based on different page templates and collections in your Shopify store.
In each of the files listed above, locate the beginning of the file.
Insert the following code at the top of each file to handle different templates:
Replace "collectiontemplate" with the page or collection page assigned name, found on the top of the editor.
{% if template.suffix == "collectiontemplate1" or
template.suffix == "collectiontemplate2" or
template.suffix == "collectiontemplate3" or
template.suffix == "collectiontemplate4" or
template.suffix == "collectiontemplate5" or
template.suffix == "collectiontemplate6" or
template.suffix == "collectiontemplate7" %}
{% assign _new_menu = linklists.handle.links %}
{% else %}
{% assign _new_menu = section.settings.menu.links %}
{% endif %}
In each file, locate the loop that iterates over the menu links. It might look something like this:
{%- for link in section.menu.links -%}
Replace that line with the following to use the newly assigned _new_menu:
{%- for link in _new_menu -%}
This approach allows you to tailor your site's navigation experience based on the content or design of individual pages and collections, enhancing usability and design consistency.
Example:
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025