Canonical tags allow webmasters to indicate the original or preferred URL for pages that may be duplicated across multiple URLs.
These tags help search engines select the correct URL for inclusion in their results, consolidate link signals to a single preferred page and avoid wasting crawl budget by requesting and rendering multiple URLs for the same content.
How To Add Canonical Tags To Pages
1. Add Link Tags within <head> of HTML
The most common way to add canonical tags to pages is by adding a <link> tag within the <head> of a HTML document.
Similar to adding HREFLANG tags, canonical <link> tags must include the “canonical” value for the “rel”(relationship) attribute, as below:
<link rel=”canonical” href=”https://www.example.com/article1/” />
2. Include a Canonical HTTP Response Header
While less commonly used, search engine crawlers also support the inclusion of canonical directives in HTTP response headers.
This solution is often best when the URL in question is not a HTML document – a PDF file, for example.
Canonical HTTP response headers should be added as in this example from Google’s canonical guidelines:
Link: <http://www.example.com/downloads/white-paper.pdf>; rel=”canonical”
3. Use XML Sitemaps To Indicate Canonical URLs
According to their guidelines, Google assumes that all URLs included in XML sitemaps are “suggested as canonicals” or “pages you consider most important on your site.”
While there is no guarantee that search engines will select all URLs in sitemaps as canonical, for large websites this is often the easiest way to indicate preferred content for indexing.
Google specifically suggests excluding non-canonical URLs from sitemaps as best practice, so it’s important to ensure your sitemaps are “clean” and include no extraneous or duplicate URLs.
When To Add Canonical Tags
Some common use cases for including canonical tags on your pages:
- To identify the original content when a page or article has been duplicated on another website. This helps ensure rightful publisher’s URL is included in search results rather than a duplicate version on another website.
- To address issues where a large number of URLs with duplicate content are crawlable by search engines, such as eCommerce category or collection pages with links to sort and filter products.
- To ensure search engines index and consolidate link properties to the right URLs when tracking and other URL parameters and are included in links to those URLs.
Note: Search Engines May Ignore Canonical Tags
While officially supported by search engines, it’s important to note that canonical tags are effectively “hints” or suggestions. From Google’s canonical tag guidelines:
“Note that even if you explicitly designate a canonical page, Google might choose a different canonical for various reasons, such as performance or content.”
To check what URL Google has selected as canonical, use the URL Inspector tool in Google Search Console.
Common Questions About Canonical Tags
- Are canonical tags necessary? While many SEO practitioners and webmasters prefer to include self-referential canonical tags on all pages, unless your website has issues with duplicate content available at more than one URL, canonical tags may not be necessary. Google often selects a canonical URL from a set of apparent duplicates without relying on canonical tags.
- How can I check canonical tags? Canonical tags are typically included within the <head> of a HTML page, similar to Meta Robots and HREFLANG tags. Searching the rendered HTML of a page for “canonical” often does the trick. However, if HTTP response headers are used to add canonical tags, a review of response headers (using Chrome Dev Tools for example) may be necessary.
- How do I check which URL Google has selected as canonical? The Google Search Console URL Inspector tool usually indicates whether a URL duplicates content found on another page, what URL the user (or webmaster) has declared as canonical and what URL Google selected as canonical (which is sometimes not the URL the user/webmaster declared).