JP30
May 3, 2020, 2:10pm
1
Hi there,
As recommended by MOZ, I would need advice on how to remove those parameters from page 1.
I would like the first paginated result to point directly to the canonical instead of the “?page=1” URL.
Indeed that creates duplicate content through the site’s pagination. More specifically, a duplicate is created of the first collections page in a particular series. This is because once you’re on a paginated URL in a series, the link to the first page will contain “?page=1”:> >
> > However, this will almost always be a duplicate page. A URL with “?page=1” will almost always contain the same content as the original non-parameterized URL.
Thanks
JP30
May 4, 2020, 4:54pm
2
solution here : https://github.com/Slam-City-Skates/better-shopify-pagination/blob/master/collection-pagination.liquid
you’ll need to slightly modify the github code (at least that’s what I did for my site to make it work).
Look for the section : {%- capture part_link_url -%} and replace the whole thing which is :
{%- capture part_link_url -%}
{%- if part.title == "1" -%}
{%- if template contains "search" -%}
{{ part.url | replace: 'page=1', '' | replace: '?&', '?' | replace: '&&', '&' }}
{%- else -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{{ part.url }}
{%- endif -%}
{%- endcapture -%}
by this :
{%- capture part_link_url -%}
{%- if part.title == "1" -%}
{%- if template contains "search" -%}
{{ part.url | replace: 'page=1', '' | replace: '?&', '?' | replace: '&&', '&' }}
{%- else -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{%- if template contains "collection" -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{{ part.url }}
{%- endif -%}
{%- endcapture -%}
Hope this helps.
The github code does not seem to work for the search template, but you should no-index it.
JP30
May 8, 2020, 7:36pm
3
That solution is bugged since it does not work if the sort_by option is enabled.
JP30:
solution here : https://github.com/Slam-City-Skates/better-shopify-pagination/blob/master/collection-pagination.liquid
you’ll need to slightly modify the github code (at least that’s what I did for my site to make it work).
Look for the section : {%- capture part_link_url -%} and replace the whole thing which is :
{%- capture part_link_url -%}
{%- if part.title == "1" -%}
{%- if template contains "search" -%}
{{ part.url | replace: 'page=1', '' | replace: '?&', '?' | replace: '&&', '&' }}
{%- else -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{{ part.url }}
{%- endif -%}
{%- endcapture -%}
by this :
{%- capture part_link_url -%}
{%- if part.title == "1" -%}
{%- if template contains "search" -%}
{{ part.url | replace: 'page=1', '' | replace: '?&', '?' | replace: '&&', '&' }}
{%- else -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{%- if template contains "collection" -%}
{{ part.url | replace: '?page=1', '' }}
{%- endif -%}
{%- else -%}
{{ part.url }}
{%- endif -%}
{%- endcapture -%}
Hope this helps.
The github code does not seem to work for the search template, but you should no-index it.
{%- if paginate.current_page == 2 -%}
{%- else -%}
{%- endif -%}
{%- if part.title == 1 -%}
- {{ part.title }}
{% else %}
- {{ part.title }}
{% endif %}