Started getting this indexing error: “Alternate page with proper canonical tag” a couple options I was directed to do. **What is the best path forward? Option 1 or 2? **
Thank you
Option 1: create a new robots.txt.liquid template. It’s becomes an “add-on” to the existing default robots.txt created by Shopify.
Read this for more details: https://help.shopify.com/en/manual/promoting-marketing/seo/editing-robots-txt
In the robots.txt.liquid, embed before
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{% endfor %}
the following (or any others):
Disallow: ?page=
After you save, the final robots.txt should exclude those pages.
Option 2:
Code change in my theme editor…
{%- if part.is_link -%}
<li>
<a
href="{{ part.url }}{{ anchor }}"
change to
{%- if part.is_link -%}
{%- if part.title == '1' -%}
{%- assign page_url = part.url | remove: '?page=1' | remove: '&page=1' -%}
{%- else -%}
{%- assign page_url = part.url -%}
{%- endif -%}
<li>
<a
href="{{ page_url }}{{ anchor }}"
What this does:
-
Checks if the page number is ‘1’
-
If yes, removes the
?page=1parameter from the URL