The canonical tag is a link element placed in the header section of web pages either when a URL may have different query string parameters or where the content on the URL may be duplicated on other internal pages or on other websites. In cases when a URL contains query string parameters (i.e. url.com/page.html, url.com/page.html?view=1, url.com/page.html?view=2), then a canonical tag should be added to the header of the web page to prevent search engines from treating each version of the URL as a unique page with duplicate content. The canonical tag informs search engines that the URL in the canonical tag should be considered the only source for the content to be included in their search results. Example canonical element: <link rel="canonical" href="https://blog.example.com/dresses/green-dresses-are-awesome" />.
Why are canonical tags necessary?
When a site has pages that are identical or similar, a number of SEO issues may arise. For instance, a large amount of duplicate content might result in site crawlers not crawling the unique content. Also, if the page does rank, there is a good chance that Google will rank the wrong version of the page. Canonical tags deal with this by telling search engines which page is the main page and which is the duplicate, resulting in the correct page being displayed in the search results.
How do you add a canonical tag?
A canonical tag is usually added to the head section of a website or web page. Here is an example of a canonical tag:
. This can be done by adding the code manually or by using a plugin in many of the popular CMS platforms.
Some documents, like PDFs, images, and word docs, don't have a head section. In cases like these, the canonical tag can be added to the HTTP headers of the URL.
When should I use a canonical tag?
Canonical tags should be added when your site has duplicate content or content that is very similar. Similar content often occurs when running an e-commerce site. What commonly happens is there might be a range of products that are essentially the same thing with minor differences like color. In order to focus Google on the main product page, a canonical tag is necessary.