How to Add Canonical Tags in Magento 2?

Canonical tag in Magento is the best way to address content duplication issues and tell search engines about the main version of the page. 

Even though you don't publish the same content on different pages or create the same products multiple times, you still need to add canonical tags.

So, here you'll learn why do you need to add canonicals and how to do this.

Why Do You Need Canonical Tags in Magento 2?

As an eCommerce website, Magento uses faceted navigation and filtering to help customers find products that fit their needs. It results in parameterized URLs like:

Besides, if you configure the category path to be displayed in the product URL, you'll eventually get multiple URLs that point to the same page:

In both examples, your website visitors will see the page as one. So it makes no difference to them.

However, if you don't add canonical tags in Magento, search crawlers will consider all of these URLs as unique pages. 

As a result, search engines will choose what version of the page to index and rank which usually is not the right page. It goes against the best SEO practices and doesn't help you improve the store ranking.

So, to boost your SEO potential and to make the "right" pages actually rank in search results, you need to add canonical tags.

How to Add Canonical Tags in Magento?

The rel="canonical" is the HTML attribute that is added within the <head> tag of the page. So, adding canonical tags usually requires editing the code. But not with Magento. 

Like other CMS, Magento allows you to add canonical tags for products and categories from the admin panel.

You just need to go to Stores > Configuration > Catalog > Catalog > Search Engine Optimization and enable the corresponding options for products and categories.

Magento Canonial Meta Tags

Once you enable these options, canonical tags will be added to your product and category pages. 

Canonical Tags in Magento 2

However, products and categories are not the only pages on your website.

What about contact, blog, CMS pages, and the homepage?

Unfortunately, default Magento doesn't cover this. So, if you want to add canonical tags to other pages as well you can rely on Magento 2 SEO Extension. It allows you to add canonical tags in Magento by enabling a few options.

To add canonical tags in Magento 2 with this module you just need to go to Stores > Configuration > Magefan Extensions > SEO and enable canonicals for any page on your store. 

Add Canonical Tags in Magento 2

How to Add Custom Canonical Tags in Magento?

In case you want to change some canonical tags or set them for pages that don't have canonical by default, SEO Extension covers that too. You can add custom canonical tags in Magento using the SEO rules. 

custom canonical tags magento 2

This covers pages with filterable results, contacts, and any other page on your store. Just specify the Canonical URL and the URL of the page you want to set it for. That's it.

Could it be any simpler?

Magento 2 canonical tags are just a small piece of the SEO puzzle. There are a lot of other SEO-related features you need to cover in your store.

However, taking small steps is the best way to go. Check out the SEO extension live demo to find out what to optimize next.