When it comes to SEO, there are several elements to consider to obtain good visibility in Google search results. One of the main pieces of information to know is that Google hates duplicate content!
When the search engine sees that some pages on your site are identical, it tends to rank you lower in the results.
Fortunately for you, there’s a solution to avoid duplicate content in your online store: the canonical tag.
By indicating the canonical URL within your store, you tell Google which page is the priority page to consider. This indication allows you to inform the search engine of the main URLs to be indexed and to avoid drops in rankings.
What is a canonical URL?
According to Google, the canonical URL is “the URL of the page considered by Google as the most representative of all the duplicated pages on your site.”
In other words, it’s used to indicate to search engines a preferred URL on your site among pages with identical content. It’s, in a way, a main page to define when several URLs on your site refer to pages with duplicate content.
When you specify a canonical URL, in theory, it’s the one that’ll be indexed and appear in the Google search results. The secondary pages will still be visited by the robots but much less than the main one.
What is a canonical tag?
To define a canonical URL in the source code of your page, you need to insert a canonical tag.
This is an HTML tag that contains the canonical URL and tells the search engine spiders that the URL in question is the “official” page.
To illustrate the concept, it’s a kind of signpost for Google, to tell it where to go and avoid the harmful consequences of duplicate content. As soon as the robot arrives on a page and identifies in the source code a canonical tag, with a canonical URL pointing to another URL, it’ll identify the main URL.
The canonical tag allows it to focus on a single URL and to spend less time on all the other pages with similar content.
How do you add a canonical tag?
There are two ways to add a canonical tag: via the HTML code or in the HTTP header of the page.
In the head tag
The simplest solution is to place a canonical tag in the HTML header of your page.
To do this, simply use this format:
<link rel="canonical" href="URL" />
For example, for this article, the canonical tag is:
<link rel="canonical" href="https://www.wizishop.com/blog/canonical-url" />
On the coding side, the tag’s code displays two main components:
- link rel = “canonical”: rel is the abbreviation for relationship. It’s therefore a link with a canonical relationship.
- href = “URL”: href is the end point of the link. It’s the main URL, considered as the official page.
In the http header
The other solution is to add a line in the HTTP header. In this case, the format is as follows:
Link: <URL>; rel="canonical"
For example, for this article, it’s the following:
Link: <https://www.wizishop.com/blog/canonical-url>; rel="canonical"
Why use a canonical URL?
First of all, it’s important to point out that every single page on your site can contain a “self-referencing” canonical URL by default, that is, a canonical URL pointing to itself. This is a good practice that serves as prevention.
Then, several situations can lead you to have very similar pages and to have to use a canonical URL, especially in ecommerce! You’ll see that duplicate content is not only the result of a lack of time or motivation to write unique content on each page.
Product files with variation
If you have products with variations, you may be confronted with duplicate content...
Depending on the ecommerce solution you use, when a product is available in different colors or sizes, it can create new URLs.
On the product page, when you click on the choice of color, size, or other variations, review the URL to identify whether or not it changes. It’s common to have, for example, "?variation=xx" added at the end. It’s therefore a new URL with completely identical content that’s generated.
For this reason, it’s recommended that you manage this configuration via a canonical tag.
Please note that on our WiziShop platform, the choice of variations doesn’t generate any URL. This is the best solution to avoid duplicate pages in order to optimize your SEO and your crawl budget.
Product present in several categories
The same product can also be present in several categories of articles.
For instance, on some websites, it’s possible to find items in the “home decor” category and in another category, such as “handmade."
In this case, and once again depending on the ecommerce solution, you may find yourself with two URLs that link to identical pages!
You must therefore choose the main category to define the canonical URL that you want to indicate.
With WiziShop, you choose the main category of your product. This configuration allows you to have a unique URL. For example, if your product is in the main category “interior decoration” and in “handmade,” the URL will always be “.../interior-decoration/product."
Tracking links and affiliation
On some pages, it’s also possible to set up tracking links.
For example, to analyze the impact of a marketing campaign, some URLs can be set up and customized to track information about a click.
In this case, the standard URL is often attached with a “?” followed by the = symbol and a number. For example, http://example.com?product=1234.
This custom URL links to the exact same page as the original. However, here again, Google may take this information for duplicate content. You must therefore configure your canonical tags properly.
Pages present on several sites
The same page can also be present under several different domain names.
In this case, since 2009, Google has made it possible to define canonical URLs between several different sites.
In other words, it’s possible to define canonical URLs between domains.
Errors related to the addition of canonical tags
As you can see, the main function of the canonical URL is to avoid duplicate content problems. However, when it’s misused, it can also harm your SEO.
Here’s a quick overview of the main mistakes encountered...
Incorrect placement of the canonical tags
As we’ve seen before, the easiest way to set up a canonical URL is to place a tag in the HTML header of your page.
However, be very careful, as your tag must be correctly placed. It must be located in the head tag only. If you integrate it in the body tag, it’ll be totally useless and not considered!
Canonical URL that links to a page with different content
The canonical URL should be used when pages have duplicate content. This is its main function.
However, it’s possible that pages with canonical URLs may point to pages that aren’t at all similar and that have very different content...this is a mistake that you’ll want to avoid.
Canonical URL that links to another URL that itself links to the first one
This is a page A that’s the official representative of several other pages. Canonical URLs shouldn’t be passed back and forth to each other. The canonical URL only works one way.
For example, if your page B has a canonical tag to your page A, your page A must not also have a canonical tag pointing to page B.
Similarly, there can only be one canonical link for a single page. Otherwise, if your main page has several canonical URLs, Google will take the initiative to retain only one. It’s better to set your canonical tag so that this choice is yours.
Canonical URL that links to a redirect
The canonical URL must point to existing pages.
If a page A has a canonical URL to a page B, which itself returns an HTTP 301 redirect code, it’s an error. The main page, targeted by the canonical tag, must be accessible and respond in code 200.
In this case, it’s better to set the canonical URL directly to the new page to which the redirect is sent.
Canonical URL that redirects to a page in errors
Even worse than the redirect is the error page. After all, your canonical URL shouldn’t point to a page with a 404 code!
If you don’t set up your URLs properly and send the robots to pages in error, you risk penalizing your SEO.
Canonical URL that returns to a page that is not indexable or is blocked via the robots.txt file
If your site has a robots.txt file indicating certain pages not to be visited, check that these pages aren’t the recipients of your canonical URLs.
In the same way, check that your main URLs don’t have noindex tags.
The role of canonical URLs is to send robots to the main pages. It would be a real shame if search engines couldn’t visit or index them, don’t you think?
Multiple canonical URLs in a chain
As I mentioned above, a canonical URL only works one way, from the secondary page B to the main page A. On page A, there shouldn’t be a canonical tag pointing to page B.
However, there shouldn’t be a canonical tag linking to another page C either. For example, your page A has a canonical to page B, which itself has a canonical to page C. This is a mistake!
Your site shouldn’t have multiple canonical URLs in a chain.
Secondary URLs in the sitemap
Since your secondary URLs refer, via canonical tags, to other main ones, they don’t really have any SEO interest.
Your sitemap file should only contain canonical URLs that are beneficial for SEO and search engine robot.
So remember not to include your secondary URLs with duplicate content in your sitemap file.
Canonical in pagination
Pagination on the internet refers to a sequence of several pages, which the user can browse by clicking on a pagination link.
For example, on a WiziShop store, the pagination designates the number of pages within a category, on which it’s possible to click at the bottom of the screen. The first page is the main page, and the following pages are called “paginated pages.”
It’s common to see canonical URLs pointing to the first page of the category on ecommerce sites and on all paginated pages.
However, each paginated page is different! They contain different products or articles and therefore different content. If we go back to the principle of the canonical URL, which is to differentiate duplicate pages, it’s clear that this isn’t the case in this situation.
For this reason, it’s crucial that each pagination page has its own “self-referencing.”
In other words, each paginated page must have its own canonical URL. Pages 2+ of the pagination must not indicate page 1 as canonical.
This is the configuration proposed on all WiziShop online stores.
Depending on the platform you use, I strongly recommend that you check your canonical URLs. A wrong configuration can lead to important SEO issues and cause you to lose in the search results rankings.
As an e-merchant using the WiziShop platform, you benefit from many native optimizations to avoid most of the issues listed above.