If you are searching for ‘Magento 2 set canonical URL’, then you are at the right place. In this article, we will discuss everything there is to know about:
So, let's get started by first developing an understanding of canonical URLs.
By now, you know that if you upload duplicate content, search engines will deindex your website promptly or apply some other penalty. However, in some cases, website owners have no choice but to use duplicate content (we will discuss more about this in detail later).
To avoid content duplication penalty from the search engines, the best course of action is to select one URL to index. Google and other search engines will only display the selected URL in search results. This allows you to keep multiple pages with duplicate content but without having to worry about any penalty.
There are several reasons why a website may have duplicate content. Let’s examine a few of them in detail.
Region VariantsThe topmost reason why websites have duplicate content is because there are two same webpages but for different regions. Suppose your store sells in the UK and the US. For whatever reason, you have two separate pages – one for the UK audience, and one for the US. It makes little sense to have different content for both pages since both pages serve the same purpose.
Device VariantsSimilarly, a few websites have set up different versions for desktop and mobile phone users. Again, although they are two different pages, they have the same content.
Protocol VariantsAdditionally, your website may have two webpages – one with HTTP and the other with HTTPS. From the crawler’s perspective, they are two different pages. So, you’ll have to determine which one to index.
Other ReasonsOther common reasons include failing to remove demo or test pages before getting the website live.
Content duplication is a common issue in e-commerce stores. This is because e-commerce stores have a lot of unique pages with almost the same content. For example, multiple products or category pages may have the same or very similar content i.e. product descriptions, features, guidelines, etc. This can also happen if you have a snippet of text that appears on multiple pages.
Having a short duplicate content is OK but if it exceeds 100 words, Google may think of it as a copy of another page with a distinct URL leading to content duplication issue. This is where the concept of canonical tags comes into play. A canonical tag on a page tells search engines that this page is an exact copy of the destination URL and hence should not be treated as a unique page.
Keep in mind that setting a canonical URL does not indicate the crawler will accept your request. Remember, the canonical URL is a hint, not a rule. To improve the probability of the crawler accepting the canonical URL, follow these best practices:
Although Magento 2 allows adding/implementing canonical tags from within its admin panel, the choices are very limited. Therefore, we believe that the best way to add canonical tags in Magento 2 is through a third-party extension. For this article, we will implement the canonical URLs using the Magento 2 Canonical URL Extension that offers some advanced features when it comes to adding a canonical tag.
The extension allows you to add a canonical tag for each product page from the product edit sheet with the following options.
Go to any product from backend and expand the Search Engine Optimization section.
To add canonical URL to CMS page in Magento 2, Open:
In this way, you can easily add canonical URL to homepage as well.
To add canonical URL to category page in Magento 2, Open:
You can configure the addition of canonical Meta tag to a storefront, store view, or a custom URL as well.
With the help of the extension, you can exclude specific product or category pages from canonical tags application.
This feature allows you to add a canonical tag to pagination pages. You can also elaborate relativity of layered navigation pages to products and category pages.
To make the most of this extension in terms of SEO, add trailing slash for canonical Meta tag. This will make your store’s URLs user and search engine friendly.
This Magento 2 Canonical URL extension is a complete content duplication solution. It makes canonicalization super easy to implement. With the introduction of the above extra features, it makes your pages more crawlable and search engine friendly while improving the ranking signals for content available through multiple URL structures.
That’s it for this tutorial. If you have any issue in adding canonical tags in Magento 2, then ask our expert Magento support team.
Related Articles: