Re: Add meta description for collections/all page.

Add meta description for collections/all page.

forteuser
Visitor
3 0 2

I have a store using the Taste theme and would like to add a meta description to the collections/all page. How can I do that?

Reply 1 (1)

BlackCro
Shopify Partner
42 8 7

This can't be changed via the Shopify backend, however with a little custom code you can add your own title and description. 

 

In Theme.liquid you will find the following code near the top of the page 

 

    <title>
      {{ page_title }}
      {%- if current_tags %} &ndash; tagged "{{ current_tags | join: ', ' }}"{% endif -%}
      {%- if current_page != 1 %} &ndash; Page {{ current_page }}{% endif -%}
      {%- unless page_title contains shop.name %} &ndash; {{ shop.name }}{% endunless -%}
    </title>

    {% if page_description %}
      <meta name="description" content="{{ page_description | escape }}">
    {% endif %}

 

Please replace it with the new code below 

 

{% if canonical_url == 'https://store-name.myshopify.com/collections' %}
  <title>Custom Title Here</title>
  <meta name="description" content="Custom Description Here">
{% else %}
  <title>
	{{ page_title }}
	{%- if current_tags %} &ndash; tagged "{{ current_tags | join: ', ' }}"{% endif -%}
	{%- if current_page != 1 %} &ndash; Page {{ current_page }}{% endif -%}
	{%- unless page_title contains shop.name %} &ndash; {{ shop.name }}{% endunless -%}
  </title>
  {% if page_description %}
	<meta name="description" content="{{ page_description | escape }}">
  {% endif %}
{% endif %}

 

You will need to add your collection page URL in place of https://your-store-name.myshopify.com/collections and then change the Custom Title Here and Custom Description Here text to whatever you need.

 

Hope this helps

Simon

BlackCro.co.uk

A creative code agency