Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I'm trying to assign a different menu and logo to page titles that contain specific words. If I change 'page.title' to 'template' the code below works... anybody know why this doesn't work for page.title?
<ul class="nav mobile-site-nav">
{% if page.title contains 'stroller' %}
{% assign menu_handle = 'amababy-strollers-menu' %}
{% else %}
{% assign menu_handle = 'main-menu' %}
{% endif %}
Also, trying to figure out how I can assign a different logo based on the page title as well?
The code looks right. Is your page title 'stroller'. Please display the page title on your page and confirm if the title is the same. Sometimes minor differences causes such issues.
Well the pages I want it to on do contain the word stroller although it's not the only word in the title.
For example, I have 3 strollers and want it to apply to any page title with the word stroller in it, any product title with the word stroller in it and any collection title with the word stroller in it.
I just did a test and realised the code works when I use == instead of contains but only if I use the full product title which means I'd have to edit the code everytime we introduce a new stroller. Is it possible to do this with tags maybe? I'm new to coding so still trying to wrap my head around it
Just figured out that it is case sensetive, thank you for your help.
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