SEO, AdWords, affiliates, advertising, and promotions
Hi there,
I'm launching a new website, www.lespetits.fr very soon. By default, the Product Vendor does not appear in the Page Title for SEO purposes, only the product name. My store is a multi-branded store, with desirable brands, so I need this for SEO. If i include the Vendor in the product name, it makes it very long. I saw someone a while ago post some code to automatically pull through the Product Vendor to the Page Title, but have no idea where to put this in the backend. Can anyone help please?
Many thanks,
Lauren
Find the <title> tag in your theme.
It might look something like this:
{%- capture seo_title -%}
{%- if request.page_type == 'search' and search.performed == true -%}
{{ 'general.search.heading' | t: count: search.results_count }}: {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ' -%} – {{ 'general.meta.tags' | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ 'general.meta.page' | t: page: current_page }}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}
<title>{{ seo_title | strip }}</title>
Change to this:
{%- capture seo_title -%}
{%- if request.page_type == 'search' and search.performed == true -%}
{{ 'general.search.heading' | t: count: search.results_count }}: {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ' -%} – {{ 'general.meta.tags' | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ 'general.meta.page' | t: page: current_page }}
{%- endif -%}
{% if template contains 'product' %}
– {{product.vendor}}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}
<title>{{ seo_title | strip }}</title>
Check it shows how you want. Assuming ALL products have a Vendor specified and the naming convention makes sense accross the board. If not, there are other ways to approach it using liquid conditionals like IF Vendor not blank or IF tag exists or IF vendor not xyz THEN use this title tag pattern, ELSE use this pattern.
Every theme tends to have a slightly different title block, so the above may not work directly, but is an example of one way it can be done.
Thank you so much Kieran, much appreciated. I've sent you a private message re a quote for this work if possible.
Thanks,
Lauren
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024