Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi there,
For SEO purposes, I'd like to change product titles depending on what collection it's being shown on.
For example, we sell chargers, for the keyword "iPhone charger", on the collection iPhone chargers, I'd like the product title to include the word iPhone. However, for the keyword "Samsung charger", on the collection Samsung chargers, I'd like the product title to include the word Samsung.
Same for cables etc.
One of our competitors has achieved great organic rankings doing this for brands and different models (it's in Dutch):
https://www.gsmoplader.nl/opladers/apple/iphone-12/
https://www.gsmoplader.nl/opladers/apple/iphone-13/
Hi,
Need to add conditional logic At collection.liquid
Code example
{% assign collection_handle = collection.handle %}
{% if collection_handle == 'iphone-chargers' %}
{% assign new_title = product.title | prepend: 'iPhone ' %}
{% elsif collection_handle == 'samsung-chargers' %}
{% assign new_title = product.title | prepend: 'Samsung ' %}
{% else %}
{% assign new_title = product.title %}
{% endif %}
<h2>{{ new_title }}</h2>
Please share your store url
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024