Canonical URLs

10-15 minIntermediate

Shopify handles canonicals automatically, but a common issue is "duplicate" product URLs (one at /products/item and one at /collections/name/products/item).

Prerequisites

  • Access to theme code (Edit Code)
Advanced Recommended

Fixing Duplicate Product URLs

Ensuring collection pages link to the canonical product URL, not the collection-aware URL.

1

Edit Product Grid Item

1

Go to Online Store > Themes > Edit Code

2

Locate the snippet for product cards (often product-card.liquid, card-product.liquid, or in main-collection-product-grid.liquid)

3

Find the anchor tag {{ product.url | within: collection }}

4

Remove | within: collection filter

5

It should just be {{ product.url }}

6

This forces links to point to /products/handle directly

This prevents "link juice dilution" by consolidating everything to the main product URL.

Verification Checklist

  • Go to a collection page
  • Click a product
  • URL in browser bar should be /products/handle (NOT /collections/name/products/handle)