fbpx

Proper Use of Canonical Tags

Understanding Canonical Tags

Canonical tags are essential for preventing duplicate content issues by telling search engines which version of a URL is the preferred one. This is particularly important in eCommerce platforms like Shopify and WooCommerce, where product variations can lead to multiple URLs for essentially the same content.

Implementing Canonical Tags in Shopify

Shopify automatically includes canonical tags in its themes. However, if you need to customize them, you can do so by editing the theme’s theme.liquid file.

{% if canonical_url %}{% else %}{% endif %}

This code checks if a canonical URL is set; if not, it defaults to the current page URL.

Implementing Canonical Tags in WooCommerce

In WooCommerce, you can use the Yoast SEO plugin to manage canonical tags easily. Once installed, navigate to the product page and scroll down to the Yoast SEO meta box. Under the “Advanced” tab, you can set a custom canonical URL.

If you prefer to add canonical tags manually, you can do so by editing your theme’s header.php file:

ID) . '" />'; } ?>

This code snippet ensures that the canonical URL for product pages is set to the product’s permalink.

Best Practices

  • Always use absolute URLs in your canonical tags.
  • Ensure that each page has a unique canonical URL.
  • Regularly audit your site to check for any issues with canonical tags.