Canonicalizing /collections/all/[name] pages to /collections/[name] ("Products Tagged With" collections)

Hello,

On my site, there are about a dozen near-duplicate “Collections” pages following two similar-but-distinct URL paths that are not canonicalized. Both were generated automatically by Shopify.

This does not present any UX problems as the content is near-identical, but does present SEO problems, because the site nav links to (for example) /collections/shirts while product pages contain anchors such as “Products Tagged Shirts” that link to /collections/all/shirts.

/collections/shirts available through the site nav is the preferred page for viewing each collection and has some custom copy. /collections/all/shirts contains the same product collection index but without any customized copy added.

It is a complete non-issue aside from SEO indexing purposes so I would prefer to simply create rel=canonicals. I do not think there’s a native method to create wildcard canonicals.

If wildcard were possible:

/collections would be self-canonical

/collections/all would be self-canonical

/collections/all/* would canonicalize to /collections*

But some of the “Tags” that auto-generated /collections/all/name pages do not match the nav URL path anyway, so I still need a way to manually canonicalize.

Let’s say I need to do this

/collections self-canonical

/collections/all self-canonical

/collections/all/shirts to /collections/shirts

/collections/all/blouses to /collections/womens-shirts

/collections/all/pants to /collections/pants

etc.

I can only find documentation on managing product canonicals, not for collections, and not for these auto-generated collections that exist because of tags.

Alternatively if there were a way to simply change the TAGGED AS anchor target URL to match the nav URL, that would work, but it seems likely to be more complicated. And I prefer not to use 301s as it’s not a good practice to use 301s for internal links.

Thanks and appreciate any help. Let me know if any of this needs clarifying.

In your theme code, find where the canonical is output:

  • search the theme for canonical_url;
  • in Dawn-family themes it is one line in layout/theme.liquid: <link rel="canonical" href="{{ canonical_url }}">).
  • Replace that line with:

{%- liquid
  assign canonical = canonical_url
  if collection.handle == 'all' and current_tags.size > 0
    assign origin = canonical_url | split: '/collections' | first
    assign t = current_tags | first | handleize
    assign target = t
    # tags whose collection handle differs from the tag:
    if t == 'blouses'
      assign target = 'womens-shirts'
    endif
    assign canonical = origin | append: '/collections/' | append: target
  endif
-%}
<link rel="canonical" href="{{ canonical }}">

Result:

  • /collections and /collections/all: untouched, self-canonical.
  • /collections/all/shirts: canonical becomes /collections/shirts (tag matches the handle, which is the default path, so no config needed).
  • /collections/all/blouses: the one exception line sends it to /collections/womens-shirts. Add one if per mismatched tag.
  • Any tag whose handle already matches the nav collection needs no entry.

Notes:

  • Multi-tag URLs like /collections/all/a+b map to the first tag’s collection.
  • women-shirts, blowses etc. are hardcoded in the above code. So you have to add each. Ask shopify sidekick (Shopify’s AI) if you dont understand the code.

I tested on a Dawn store.

Hi there @pdintane,

Hi there! You are completely right to avoid using 301 redirects for internal links. Using canonical tags is the perfect SEO solution for this exact problem.

Unfortunately, Shopify does not have a native dashboard to manage canonical URLs for tag-generated pages like /collections/all/shirts. However, you can fix this manually by adding a simple piece of code to your theme.

Here is how you can set up those specific manual mappings:

  1. Go to your Shopify Admin > Online Store > Themes > Edit code.
  2. Open your theme.liquid file.
  3. Look for the default canonical tag, which usually looks like this:
  4. Replace that single line with an if/elsif statement to map your specific tag URLs to your preferred collections. It should look like this:

codeLiquid

{% if request.path == '/collections/all/shirts' %}
  <link rel="canonical" href="{{ shop.url }}/collections/shirts">
{% elsif request.path == '/collections/all/blouses' %}
  <link rel="canonical" href="{{ shop.url }}/collections/womens-shirts">
{% else %}
  <link rel="canonical" href="{{ canonical_url }}">
{% endif %}

This code tells Google exactly which page is the “master” version, without redirecting the user or breaking your internal product tags.

If you have a lot of these tags, managing this code manually can get very messy and hard to track. To make this much easier, I highly recommend using SearchPie: SEO, Speed & Schema. It gives you a clean dashboard to set up custom canonical tags for any page, collection, or tag URL without you ever having to touch the theme code.

Hope this helps you clean up your indexing!

Hi @pdintane,

One thing I’d recommend before implementing it is to make sure those tag pages actually have unique value. If /collections/all/shirts and /collections/shirts show essentially the same products and content, canonicalizing to the main collection makes sense. But if the tag page is intentionally serving a different purpose with unique content or filtering, I’d think twice before consolidating it.

Also remember to test the output after making the change. View the page source or inspect the rendered HTML to confirm the correct canonical is being generated and then verify it with Googles URL Inspection tool or Rich Results Test to ensure Google is seeing the expected canonical URL.

For a small number of mappings the theme edit is perfectly manageable. If you are dealing with dozens or hundreds of custom mappings though it may be worth rethinking the collection structure rather than maintaining a long list of hard coded rules.

Hi @pdintane ,
This is a common SEO issue with Shopify. The /collections/all/{tag} URLs are automatically generated tag-filter pages, and Shopify doesn’t provide a native way to assign custom canonical URLs for them in the admin.

If you are comfortable editing your theme, you can override the canonical URL in theme.liquid using conditional Liquid logic:

{% if collection.handle == 'all' and current_tags %}
  {% case current_tags.first %}
    {% when 'shirts' %}
      <link rel="canonical" href="{{ shop.url }}/collections/shirts">
    {% when 'blouses' %}
      <link rel="canonical" href="{{ shop.url }}/collections/womens-shirts">
    {% when 'pants' %}
      <link rel="canonical" href="{{ shop.url }}/collections/pants">
    {% else %}
      <link rel="canonical" href="{{ canonical_url }}">
  {% endcase %}
{% else %}
  <link rel="canonical" href="{{ canonical_url }}">
{% endif %}

Alternatively, if those “Products tagged…” links are generated by your theme, you can update the link to point directly to your preferred collection URL instead of /collections/all/{tag}. This is often the cleaner solution because it avoids creating duplicate internal links in the first place.

I wouldn’t recommend using 301 redirects for internal navigation if you can avoid them. Fixing the internal links or overriding the canonical tag is generally the better SEO approach.

Hey @pdintane ,

What you’re seeing is expected Shopify behavior. Tag based URLs such as /collections/all/shirts are generated automatically and Shopify doesn’t provide a native way to define custom canonical URLs for collection or tag pages from the admin.

If you’re comfortable editing your theme, you can override the canonical tag in your SEO/Liquid templates by adding custom logic. However, because your mappings aren’t one to one (for example, /collections/all/blouses/collections/womens-shirts), you’ll need to maintain a mapping yourself either in Liquid, a metafield, or another data structure. Shopify doesn’t support wildcard canonical rules for this type of URL.

Another approach, which may actually be cleaner, is to update the Liquid code that generates the “Products Tagged…” links so they point directly to your preferred collection URLs instead of the automatically generated /collections/all/... paths. That reduces internal links to the duplicate pages and helps reinforce the canonical URLs you actually want search engines to index.

I also agree with avoiding internal 301 redirects where you can simply output the correct destination URL in the first place.

If you found my reply helpful, feel free to mark it as the accepted solution so it can help other merchants following this discussion.

Thank You !

Hello @pdintane,

Building on what ajaycodewiz and PieLab outlined, one thing worth knowing before you go deep on the canonical mapping: Google may not fully respect those tags precisely because your product pages are actively linking to /collections/all/shirts via the “Products Tagged X” links. When internal link signals and canonical declarations conflict, Google tends to go with the link graph, especially if those /collections/all/* URLs are already well-crawled.

The more durable fix is actually at the source. Those “Products Tagged X” links come from your product template, usually rendered via something like product.tags | link_to_tag in Liquid. Find where that tag output is in your product template and modify it to point to /collections/shirts directly instead of /collections/all/shirts. For the handful of mismatches you mentioned (blouses → womens-shirts, etc.), a short case block in Liquid covers it cleanly. That stops Google from continuously getting crawl signals for the pages you’re trying to suppress.

Canonicals still make sense as a second layer for URLs Google already has indexed. But fixing the links is what removes the internal pressure.

To verify after you implement: URL Inspection in Search Console on any /collections/all/shirts URL shows you “Google-selected canonical” vs your declared one. If they match, the canonical is being respected. If Google selected the /collections/all/* version despite your tag, that’s the internal link signal winning.

(post deleted by author)

I ran into something similar on a Shopify store.

Unfortunately, Shopify doesn’t provide a built-in way to define custom canonical URLs for collection pages like /collections/all/. By default, the canonical is generated by the theme, so if you want different canonicals for specific collection URLs, you’ll usually need to edit the theme’s theme.liquid or the SEO/canonical logic in the collection template and add conditional rules.

If the /collections/all/ URLs aren’t meant to be primary landing pages, another option is to update the links that generate those URLs (where possible) so they point directly to your preferred collection pages instead. That avoids sending mixed signals to search engines.

I agree with avoiding internal 301s just to fix navigation. If you have access to the theme code, handling the canonical or updating the link source is generally the cleaner approach.

One thing I’d also consider is whether those /collections/all/… pages are actually receiving meaningful traffic or impressions before investing time in custom canonical logic. If they’re not contributing anything, simplifying the internal linking structure so users and crawlers naturally reach the preferred collection pages may solve most of the problem with less maintenance.

You can output a custom canonical in Shopify’s theme code, so you’re not limited to product canonicals. The tricky part is your mapping because shirts -> shirts but blouses -> womens-shirts, etc. I’d use a small lookup based on the collection handle rather than trying to build a wildcard rule.