{%- if page_description -%}
{% if template == 'list-collections' %}
{% else %}
{%- endif -%}
{%- endif -%}
The line where I have “settings.metadescriptioncollections” is because I set a field in the theme settings so it can be managed from there, rather than hard coding it into the theme.liquid file.
I wanna change it for my collections/all page as well, the indexed page in google shows the first text on the black banner and promo banner. I tried the solution above and replaced ‘collection-list’ with ‘/collections/all’ , then tried with list-collections-template, then list-collections, collections/all…
None of the above worked, I dont know what the correct term is to put instead collection-list. When I inspect my page it still shows the main page meta description. And any idea why Google indexed it with the text on the page instead of at least the main page meta description?
I actioned this exactly as you advised and the page is still missing it’s description. See my code below. Can you tell me where in the theme settings are you managing this?
{%- if page_description -%} {% if template == ‘/collections/all’ %}
In your templates folder you will have a file something like list-collections.json Do you have that ? Could be collection-list ? It can be different for different themes. What ever that file is called thats what you should put in this part: {% if template == ‘list-collections’ %}
Step 1. You need to check the name of that collection file in the template folder. What ever that name is, will be the name you put in the code.
if the file name is list-collections.json, then the line should be {% if template == ‘list-collections’ %}
if the file name is collection-list, then the line should be {% if template == ‘collection-list’ %}
Step 2. Once you have the correct code, you need to find the file that contains this particular code below. For me, I found it in
Doc-head-core.liquid but for you, it could be in a different file.
Find this code somewhere in your current files:
{%- if page_description -%}
{%- endif -%}
Step 3. Once you find the above code you need to replace it with the new code. You need to make sure you use the correct list-collections name ( which you found in Step 1 ) :