I am a novice atm when it comes to editing liquid. I am trying to have a different menu for a page based off the page title. I am using the Flex theme from out of the sandbox.
A brand lets call them blender, redirects a customer to my site, that customer lands on a page titled “blender” I would like the blender page AND the blender collection page to have a menu with the handle “blender menu” instead of my main menu.
I would assume I need to edit the header-classic.liquid file with an IF statement, I found this code from @Savior bellow that I believe should work for this, but im not sure where to put it.
{% if page.handle contains “Blender” %}
{% assign menu = ‘blender-menu’ %}
-
<a href={{ link.url }}>{{ link.title }}
{% for link in linklists[menu].links %}
{% endfor %}
{% else %}
{% assign menu = ‘main-menu’ %}
-
<a href={{ link.url }}>{{ link.title }}
{% for link in linklists[menu].links %}
{% endfor %}
{% endif %}
Is this below code what I should edit to achieve this?
“type”: “header”,
“content”: “Navigation”
},
{
“type”: “link_list”,
“id”: “main_linklist”,
“label”: “Main menu”,
“default”: “main-menu”
}
Or would i place it somewhere in here?