Canonical tag: what it is and how to use it correctly

Share this article

The canonical tag lets us tell Google and other search engines which URL should be treated as the main version when there are several pages with identical or very similar content.

What is a canonical tag?

A canonical tag (rel=”canonical”) is a piece of HTML code added to a URL to indicate the preferred version of a page to search engines.

It is especially useful when there are different pages with duplicate or very similar content, since it helps search engines understand which version should be consolidated as the main one.

The canonical tag was introduced by Google, Bing, and Yahoo in 2009 as a simple way to deal with duplicate content.

The canonical tag is placed inside the section of the page and looks like this:

<link rel="canonical" href="https://www.example.com/example/" />

Why canonicalization matters for SEO

Duplicate content can become a problem, especially when a website has many URLs with identical or very similar content.

This makes crawling less efficient, since search engines may spend time accessing different versions of the same page instead of focusing on the URLs that really matter.

It can also make it harder for search engines to decide which version should appear in search results. In some cases, they may choose the wrong URL as canonical, or simply ignore the version you would rather have indexed.

Using a canonical tag helps reduce these issues by signaling which URL should be treated as the main one.

That said, it is important to remember that the canonical tag is a signal, not a directive. Google may choose a different canonical URL if other signals point elsewhere.

Using the canonical tag to solve duplicate content issues

Duplicate content problems can be harder to detect than they seem, because we usually think in terms of pages and content, while search engines crawl URLs.

A simple example is an e-commerce product page. A product might use the URL example.com/product, but after applying a filter, the URL becomes example.com/product?size=m. For users, it may still look like the same page with just one option selected. For search engines, however, the URL has changed because it now includes a parameter, so it may be treated as a separate URL with duplicate or near-duplicate content.

E-commerce websites are not the only ones affected by this. Other common cases include search parameter URLs such as example.com?s=query, separate mobile URLs such as m.example.com, versions with and without www, http and https versions, URLs with and without a trailing slash, or versions that differ only in capitalization.

In all of these situations, it is important to implement the canonical tag so it points to the preferred URL in each case and helps prevent duplicate content issues.

How to use the canonical tag correctly

When implementing canonical tags on a website, it is important to make sure they point to the correct URL.

  1. Use the correct URL format. Use the preferred version of the domain consistently, including protocol and host. Although relative paths are allowed, absolute URLs are generally the safer option.
  2. A canonical tag can point to itself. This tells search engines that the current URL is the preferred version.
  3. Canonicalize the homepage as well. It is common for external links to point to homepage variants using the wrong protocol or host. Redirects should ideally handle these cases, but a self-referencing canonical still helps reinforce the preferred version.
  4. Be consistent across the site. If one URL is the preferred version, all duplicate URLs should point directly to it. Avoid canonical chains.
  5. Cross-domain canonicals are possible. A canonical tag can point to a URL on a different domain. This is useful when the same content is published on more than one site and you want to indicate which version should be treated as the main one.

Implementing the canonical tag

There are several ways to indicate a canonical URL: by using an HTML tag in the page head, an HTTP header, the sitemap, redirects, and internal linking. Some methods are stronger than others, and each one makes more sense in different situations. Google lists redirects and rel=”canonical” as stronger signals, while sitemap inclusion is considered weaker on its own.

HTML tag

The most common way to implement a canonical tag is to add it to the HTML of each page inside the <head> section.

<head>
  ...
  <link rel="canonical" href="https://www.example.com/canonical/" />
  ...
</head>

HTTP header

An HTTP header is the right option when the file is not HTML. For example, a PDF cannot include a canonical tag in the because it does not have one.

Link: <https://www.example.com/canonical/>; rel="canonical"

Sitemap

According to Google, non-canonical pages should not be included in the sitemap, since sitemap URLs are treated as a canonical signal.

Still, a sitemap is only one signal among others, so Google may choose a different canonical URL if the rest of the signals are inconsistent.

301 redirects

This method deserves to be treated separately because the outcome is not exactly the same, especially from a user perspective. For search engines, a redirect is a very strong canonicalization signal.

For example, if you have two very similar products and want to keep both available to users, a redirect would prevent one of them from being accessed. In that case, a canonical tag is usually the better option, since it signals the preferred URL to search engines while still allowing users to visit both pages.

Redirects are a better fit when choosing between https and http, or between www and non-www, so the whole site remains consistent under a single domain version.

Internal linking

Internal linking is one of the signals search engines use to understand which URLs are important within a site.

By consistently linking to the preferred version of a page, you reinforce the canonical signals you are sending elsewhere. Internal links, canonicals, redirects, and sitemap URLs should all align as much as possible.

In short, the canonical tag helps prevent duplicate content from becoming an SEO problem. Consistency across the site and correct implementation are essential if you want search engines to treat the desired URL as the canonical one.


Share this article
raul revuelta seo y marketing digital

About me

Raúl Revuelta

Digital marketing consultant specialized in SEO, CRO, and digital analytics. On this blog, I share content about these areas and other topics related to digital marketing, always with a practical, business-focused approach. You can also find me on LinkedIn and X.

Leave a Comment

Your email address will not be published. Required fields are marked *

Would you like to talk about your project?

Scroll to Top