Collection pages not properly canonical url to the original URL

Collection pages not properly canonical url to the original URL

April 5, 2024

In Shopify Collection pages on the website are currently paginated as 1, 2, 3, 4, 5,… and are not properly canonicalized to the original URL. For example, the URL https://wrapsify.com/collections/motorcycle-gifts?page=2 is currently canonicalized to itself: https://wrapsify.com/collections/motorcycle-gifts?page=2.

Screenshot 2024-04-05 at 12.56.28.png

 

However, If  you want  1, 2, 3, 4, 5,… of this collection to be canonicalized to the original URL: https://wrapsify.com/collections/motorcycle-gifts

 

Here is the solution for you

Just update the theme liquid file

Steps to find the theme.liquid 

  • Go to “Online Store” and then click on “Themes.”
  • Find the theme you want to edit and click on “Actions” > “Edit code.”
  • Locate theme.liquid:
  • In the left sidebar, you’ll see a list of files. Look for “theme.liquid” and click on it.

 

Find

<link rel=”canonical” href=”{{ canonical_url }}”>

Replace with

<link rel=”canonical” href=”{{ canonical_url | split: ‘?’ | first}}”>

 

It will fix all the pagination issues with blogs as well.

 

Avada Programmer

Hello! We are a group of skilled developers and programmers.

Hello! We are a group of skilled developers and programmers.

We have experience in working with different platforms, systems, and devices to create products that are compatible and accessible.