A canonical tag also known as ‘rel canonical’ is a snippet of HTML code placed within the <head> section of a web page that tells search engines that a specific URL contains the same content as the master copy of a page.
The URL with the canonical tag specifies to the search engine that this version of the page is the main one and thus, should be indexed.
Canonical tags help Google understand which version of a page to index and rank for relevant queries. They also tell Google where to consolidate or split any “link equity.”
If you don’t add a canonical tag, Google will identify on its own the best version of the URL. Although this may seem less hectic on your end, it isn’t a great idea to rely on Google to do so since it could select an undesirable version of your page.
Duplicate content pages can also affect your “crawl budget” as Google may end up wasting time crawling these duplicate pages instead of other important content on the site.
It’s easy to make mistakes with canonicalization, so it pays to regularly audit your website for issues related to canonical tags and to fix them ASAP.
For this, you can use the SEMRUSH Site Audit tool. This tool scans your site for over 100 SEO issues, including those related to canonical tags.
This is the simplest way to specify a canonical URL. All you have to do is add the following code to the <head> section of the page:
<link rel=“canonical” href=“https://example.com/canonical-page/” />
When there’s no place to add canonical tags in the page headers, for example in PDFs, you’ll have to use HTTP headers to set canonicals.
P.S. HTTP headers can also be added to standard webpages.
Non-canonical URLs shouldn’t be included in sitemaps.
301 redirects help to divert traffic away from a duplicate URL to the canonical URL.