4 min read

How to use rel=canonical

How to use rel=canonical

A canonical URL is a way to inform search engines that certain similar URLs are, in fact, the same.

This is particularly useful when you have products or content accessible through multiple URLs or even different websites.

You can include these variations on your site without negatively affecting your search engine rankings by employing canonical URLs (implemented as HTML link tags with the "rel=canonical" attribute).

In this article, we will explore the concept of canonical URLs, when and how to use them, and how to avoid or rectify common mistakes.

Table of Contents

  • Understanding the Canonical Link Element
  • The SEO Benefits of "rel=canonical"
  • The Canonicalization Process
  • How to Set Canonical URLs
  • Selecting the Canonical URL
  • Adding the "rel=canonical" Element
  • When to Use Canonical URLs
  • 301 Redirect vs. Canonical
  • Self-Referencing Canonical URLs
  • Cross-Domain Canonical URLs
  • Common Issues with Faulty Canonical URLs
  • Canonical URLs and Social Networks
  • Advanced Uses of "rel=canonical"
  • Canonical Link HTTP Header
  • Using "rel=canonical" on Not-So-Similar Pages
  • Combining "rel=canonical" with hreflang
  • Conclusion: The Power of "rel=canonical"
  • Understanding the Canonical Link Element

Canonical Link or Canonical Tag

The "rel=canonical" element, often referred to as the "canonical link" or "canonical tag," is an HTML element designed to help webmasters address the problem of duplicate content. It does so by specifying the canonical URL, indicating the preferred version of a web page. Typically, this is the source URL. Using canonical URLs is a crucial aspect of enhancing your website's SEO.

The concept is straightforward: when you have multiple versions of identical content, you select one as the "canonical" version and direct search engines to prioritize displaying that version in their search results.

A canonical URL is embedded in a webpage's source code, viewable by search engines but not affecting your users' experience.

The SEO Benefits of "rel=canonical"

The history of "rel=canonical" dates back to its introduction by Google, Bing, and Yahoo! in February 2009. It was developed as a technical solution to manage duplicate content, posing a significant SEO challenge.

When search engines encounter multiple nearly identical pages, they struggle to determine which to include in search results. Consequently, all such pages may receive lower rankings.

For instance, you might have a product or post that belongs to two categories and is accessible through two URLs:

https://example.com/black-shoes/black-and-red-shoes/

https://example.com/red-shoes/black-and-red-shoes/

If both URLs represent the same product, designating one as the canonical URL informs search engines to display that specific version in search results.

Canonicalization, in practice, involves choosing one URL from several options for a product. While this decision is often straightforward, it can sometimes be less precise. Nevertheless, choosing and setting a canonical URL is preferable to not using canonicalization.

How to Set Canonical URLs

Let's talk tactical.

Selecting the Canonical URL

If you have two identical pages with separate URLs (e.g., https://example.com/wordpress/seo-plugin/ and https://example.com/wordpress/plugins/seo/), choose one as the canonical version. Typically, prioritize the one you consider the most important.

If there's no clear preference, opt for the version with the most backlinks or visitors. If all factors are equal, a random choice suffices.

Adding the "rel=canonical" Element

Implement the "rel=canonical" link from the non-canonical page to the canonical one. You can do this manually by including the "rel=canonical" tag within the HTML header of the non-canonical page. 

Here's an example of the tag implementation if the shorter URL is selected as the canonical URL:

<link rel="canonical" href="https://example.com/wordpress/seo-plugin/" />

By adding this tag, you "merge" both pages into one from the perspective of search engines. This functions as a "soft redirect" without actually redirecting users. All links to both URLs are counted as links to the single canonical version, optimizing its ranking potential.

Think you may have gaps in your SEO knowledge? Get our FREE eBook with every  single basic concept related to SEO.

When to Use Canonical URLs

Let's talk instances, now.

301 Redirect vs. Canonical

In cases of uncertainty between implementing a 301 redirect and setting a canonical URL, the general guideline is to opt for a redirect unless there are technical reasons to avoid it. If a redirect would adversely affect the user experience or present other issues, a canonical URL is a suitable alternative.

Should a Page Have a Self-Referencing Canonical URL?

Having a self-referencing canonical URL on every page is recommended. Google confirms this as a best practice. Many content management systems allow for URL parameters without altering the content. Consequently, URLs with such parameters, like those mentioned above, should point to the cleanest version of the URL to prevent potential issues.

Cross-Domain Canonical URLs

Cross-domain canonical URLs are used when the same content appears on multiple domains. In such cases, the canonical URL on the republishing site points back to the original article's URL. This allows all links to the republished content to contribute to the ranking of the canonical version.

Common Issues with Faulty Canonical URLs

  • Avoid canonicalizing a paginated archive to page 1, as this leads to search engines not indexing links on deeper archive pages.
  • Ensure that canonical URLs are 100% specific, including the full protocol (http/https).
  • Base canonical URLs on the request URL and avoid using variables like the domain in canonicalization.
  • Multiple "rel=canonical" links on a page can lead to unpredictable outcomes and should be avoided.

Canonical URLs and Social Networks

Facebook and X respect canonical URLs. When sharing a URL on these platforms, the details from the canonical URL are shared. Additionally, when using social media buttons on a page, the like count corresponds to the canonical URL, not the current one.

Advanced Uses of "rel=canonical"

Want to up your game? Here are some 104-level illustrations.

Canonical Link HTTP Header

Google supports a canonical link HTTP header, which can be beneficial for canonicalizing files such as PDFs.

Using "rel=canonical" on Not-So-Similar Pages

While not recommended, "rel=canonical" can be used quite aggressively. However, if it detects excessive use, Google may lose trust in your site's canonicals.

Using "rel=canonical" in Combination with hreflang

When implementing hreflang, ensure that each language's canonical URL points to itself to prevent issues with the entire hreflang implementation.

The Power of "rel=canonical"

"rel=canonical" is a potent tool in the realm of SEO. Canonicalization can be crucial for larger websites and lead to substantial SEO enhancements. However, like any powerful tool, it should be wielded judiciously, as misuse can have adverse effects. We trust that this guide has equipped you with a comprehensive understanding of this valuable tool and its appropriate usage.

SEO Challenges: Addressing Duplicate Content, Canonicals, and Pagination

SEO Challenges: Addressing Duplicate Content, Canonicals, and Pagination

In the ever-evolving landscape of search engine optimization (SEO), website owners and marketers often encounter challenges that can impact their...

Read More
Guide to Using Google's URL Inspection Tool

Guide to Using Google's URL Inspection Tool

Solid website optimization requires efficient tools that provide deep insights into your web pages.

Read More
Beginner's Guide to FAQ Schema: Enhance Your Google Search Presence

Beginner's Guide to FAQ Schema: Enhance Your Google Search Presence

Unlock the benefits of structured data with our comprehensive guide to starting with FAQ schema. Elevate your website's visibility on Google and...

Read More