What is a Canonical Tag? How to Use the Canonical Tag with Example
Do you want to know about canonical tag? You would be surprised to know that they are not new. They have been in existence since 2009. In fact, Yahoo, Microsoft, and Google united to create canonical tag. What is the purpose? The creation is aimed at website owners by offering them a way to duplicate content-related issues easily and effectively.
What is a Canonical Tag?
A canonical tag is a snippet of the entire HTML code that helps in defining the main version for similar, near-duplicate, or duplicate pages. In simpler words, if you have similar content under different URLs, you can leverage canonical tag to specify which version is the primary one. The primary version will eventually be indexed.
Here’s an example of a base canonical tag:
<link rel="canonical" href="https://www.example.com/original-page.html" />
This code tells search engines that the current page (the one containing this code) is a duplicate of the page at the specified URL “https://www.example.com/original-page.html” and that the search engine should prioritize the original page for indexing and ranking.
Here’s a breakdown of the code:
<link>
: This element creates a link between the current page and the canonical URL.rel="canonical"
: This attribute specifies the relationship between the current page and the canonical URL. In this case, “canonical” indicates that the linked URL is the preferred version.href="https://www.example.com/original-page.html"
: This attribute defines the URL of the canonical page.
Canonicalization in SEO: A Fundamental Concept
With respect to on-page SEO, canonical tag suggest to Google which specific version of the page it should consider indexing. Moreover, the use of canonical tag in on-page optimization also suggests to Google which page version it should consolidate link equity to while showing in the respective search results.
It is usually available in the <head> section of the webpage of the HTML source code of the page. With respect to on-page SEO optimization, you must know that Google does not prefer duplicate content. The presence of duplicate content makes it difficult for Google to select:
- Which particular version of the page it should index
- Which particular version of the page should it rank for relevant queries
- Whether or not it should consolidate ‘link equity’ on one page or divide the same between multiple versions
When your website has too much duplicate content, it also tends to affect the overall crawl budget. This implies that Google will end up wasting time in crawling different versions of the same page rather than coming across other important content on your website.
It help in resolving such issues. They assist you in telling Google which specific version of the page it should consider indexing and ranking. When you make use of the best practices for implementing canonical tag, it helps mitigate the risks of Google observing an undesirable version of the page to be canonical.
Implementing Canonical Tag: A Step-by-Step Guide
It is easy to implement canonical tags. Here are some best practices to consider:
1. Using Absolute URLs
Experts suggest that the best practice is to avoid using relative paths with the link element rel = “canonical.”
On the other hand, it is suggested to make use of the following structure:
<link rel= “canonical” href= https://example.com/sample-page/”>
2. Using Lowercase URLs
As Google tends to regard lowercase and uppercase URLs as two distinct URLs, you would like to enforce lowercase URLs on the server. Then, you can consider using lowercase URLs for the canonical tags.
3. Using the Right Domain Version (HTTP vs. HTTPS)
Have you switched to SSL? It is important to ensure that you are not declaring any non-SSL or HTTP URLs in the canonical tags. If you have a secure domain, make sure that you are using the following version of the URL:
<link rel= “canonical” href= https://example.com/sample-page/>
4. Using Self-Referential Canonical Tag
While they are not compulsory, self-referential canonical tags are still regarded as important. It is usually a type of canonical tag on a dedicated page that ends up pointing to itself. Most popular CMS platforms add self-referential URLs automatically.
5. Using a Single Canonical Tag for Every Page
In case a page has multiple tags, then Google will end up ignoring both. Therefore, you should ensure that there is a single canonical tag for every page.
If you are looking for a step-by-step guide to implement, here are some points to consider:
Step 1: Setting canonicals with the help of rel= “canonical” HTML tags
Step 2: Setting canonicals in HTTP readers
Step 3: Setting canonicals in sitemaps
Step 4: Setting canonicals with 301 redirects
Canonical Tag : Examples: Real-world Applications
While referring to a canonical URL, Google typically recommends the use of absolute URLs: the entire URL along with the protocol.
The following URLs feature the same content:
https://www.example.com/example.htm
https://www.example.com/examplepage/?session_id=xyz.htm
The first one depicts the standard resource. On the other hand, the second one depicts the session that is commonly utilized by online shops for storing user-specific data. As the first URL serves to be crucial, it should represent the canonical version. The canonical version should be effectively integrated into the head element of the subsequent URL to refer to the first page. In turn, it will indicate to Google that the first URL is more crucial and it should be crawled and indexed in the search engine results pages.
Best Practices for Canonicalization
In case you are not implementing canonicals correctly, Google might end up ignoring them. This could harm the overall SEO performance. Here are some of the best practices for canonical tags that you can adopt:
Specifying a Single Canonical URL Per Page
It is recommended to specify only a single canonical URL for every page. Otherwise, you will end up confusing Google. You should be careful not to include two canonical tags within the HTML code of the webpage. If you have set the canonical tag with some settings in the CMS, avoid manually adding into the HTML.
Specifying the Right Domain Protocol
If your site is based on the HTTPS protocol, make sure that you are referencing the same as the canonical URL.
Using Absolute URLs
You should reference canonical tags with the help of absolute URLs instead of relative URLs. This implies that you should make use of the full URL, including the domain.
Conclusion
Canonical tags are not complicated, although they might be difficult to understand initially. It tell search engines that there is a standard resource or a highly relevant page aimed at resolving issues with duplicate or similar content.