On an e-commerce store, the same page can often be reached from several addresses. A product opened from a collection, a selected variant, a link with campaign parameters: to Google these are different URLs with the same content. The canonical URL tells Google which one is the right one to show in search results.
On Shopify, your theme already does much of the work. Here we look at what it handles on its own, how to check it, and where you need to step in.
What a canonical URL is
It's the address you designate as the main version of a page. It's usually declared with a tag in the <head> section:
<link rel="canonical" href="https://www.tuonegozio.it/products/maglia-gialla">
According to Google's guide to duplicate URLs, the signals for indicating the canonical are, from strongest to weakest:
- Redirect: the old URL leads to the new one. It's the strongest signal, to use when the duplicate page should no longer exist.
rel="canonical": both pages stay reachable, but you say which one you prefer.- Sitemap: including a URL in the sitemap is a weak signal in favor of that URL.
The canonical is a hint, not a command: Google may choose a different URL if the other signals (internal links, sitemap, redirects) say otherwise. That's why you want all of them pointing in the same direction.
What Shopify does on its own
In Shopify themes, the canonical tag is generated with the Liquid object canonical_url, which returns the canonical URL of the current page. As Shopify's article on canonical URLs explains, it's the page's address without parameters: for a product, the product page with no collection and no selected variant.
In practice, with a theme that uses canonical_url:
/collections/magliette/products/maglia-gialladeclares/products/maglia-giallaas its canonical./products/maglia-gialla?variant=123declares/products/maglia-giallaas its canonical.- A link with
?utm_source=...or other tracking parameters goes back to the clean URL.
How to check your theme
- Open a product page by going through a collection, so the address contains
/collections/. - View the page source and search for
rel="canonical". It should appear exactly once and point to/products/product-name, on your primary domain. - Repeat with a collection, a page and a blog post.
- In Google Search Console, use the URL Inspection tool on a product: it tells you which canonical you declared and which one Google chose.
If the tag is missing, the theme needs fixing: it's usually added in the theme.liquid file (in some themes it lives in a snippet dedicated to meta tags). Before touching the code, duplicate the theme so you have a backup.
Where duplicates come from on Shopify
Even with the canonical in place, there are situations to keep an eye on.
Internal links to URLs with the collection
Some themes, in collection grids, link to products using the address that includes the collection. The canonical makes up for it, but internal links are a signal too: if your whole site links to the non-canonical version, you're sending Google mixed signals. Wherever you can, point internal links to /products/.... It's a theme change, best done with whoever develops your theme.
Collection filters and sorting
Shopify's filters add parameters to the address (for example ?filter.v.option.colore=rosso), and so does sorting (?sort_by=...). Each combination is a different URL with very similar content. In its guide to faceted navigation, Google explains that a canonical pointing to the unfiltered version doesn't help much in the long run; if you don't need those pages in search results, the most effective approach is to prevent them from being crawled with robots.txt. We cover this in the guide to Shopify filters.
Multiple domains
If your store responds on more than one domain (the .myshopify.com one, your domain with and without www), only one should be primary and the others should redirect to it. You set this in Shopify's domain settings.
Near-identical products
Two separate products that differ only in color often share the same description. The automatic canonical doesn't help here, because they're different pages. The fixes: merge them into a single product with variants, or write genuinely different copy.
Canonical or redirect?
The rule Shopify also cites, quoting Joost de Valk of Yoast: if there's no technical reason not to, use a redirect; use the canonical when a redirect would hurt the browsing experience.
The typical cases on Shopify:
- Product deleted or URL changed: redirect to the new product or to the closest collection. Redirects are managed in the URL redirects section (under Content > Menus, according to Shopify's guide). Note that you can only redirect addresses that no longer work, not pages that are still live.
- Same product in several collections, variants, parameters: canonical, which the theme already handles.
Mistakes to avoid
- Blocking duplicates in
robots.txtthinking it solves the canonical. Google warns that blocked URLs can still end up in the index, without content. And if Google can't read the page, it can't see the canonical either. - Using
noindexto choose the canonical. Google advises against it:noindexremoves the page from search, it doesn't pass signals to the main version. - Setting a URL with
#as the canonical. Google generally ignores fragments. - Inconsistent canonicals. A canonical that points to a redirected,
noindexor 404 page confuses Google. The canonical should point to a page that returns 200 and is in the sitemap. - Deleting pages without redirecting them. If an old product has links from other sites or from Pinterest, simply deleting it throws them away. Better to redirect to the most similar thing still on sale.
The URL Parameters tool is gone
Older guides recommend telling Google which parameters to ignore with Search Console's URL Parameters tool. Google retired it in 2022: today parameters are handled with canonicals, consistent internal links and, where needed, robots.txt.
If you want a full audit of your store's canonicals, redirects and indexing, let's talk: it's part of our Shopify development and optimization work.
