Canonical tags

What is a Canonical URL?

A canonical link element, or canonical tag, is found in the HTML header of a webpage and tells search engines if there is a more important version of the page. The canonical tag appears as: rel=”canonical”.

For example, this line of HTML code tells search engines that the URL “https://shoestore.org” is the original version of the page that this tag occurs on:

<link rel=”canonical” href=”https://shoestore.org” />

The tag is important because search engines regularly crawl websites to look for information to help them decide how to rank pages and posts. If the search crawler finds two pages with the same content, it doesn’t know how to rank them . It can’t decide which page should rank, so the two pages cannibalize the ranking potential of the other. As a result, it’s possible that neither piece of SEO content will rank.

A canonical URL should be set up if you have two pages of similar content on your website or if you have content on your site that is also used on another site. You can use a canonical tag to point Google to the original content and make sure the first piece gets all of the credit and SEO benefits.

 

Canonical URLs vs. Noindex Robots Meta Tags: What’s Better?

Another way you may want to resolve duplicate content issues is by blocking search engines from crawling the page in the first place. Through meta tag SEO and a robots meta tag, you can tell search engines not to crawl your pages, which may seem like quick a fix. In most cases, however, the more pages Google can crawl on your website, the better. So it’s usually best to use noindex for pages that you do not intend to rank or get traffic for.

How to Set Up a Canonical URL

Now that you understand why you would want to use a canonical tag and how it can help you, it is time to add this tag to your own site. There are multiple ways to do this depending on the plugins that you use and your comfort level of adding code to your website.

While there are many methods to choosing the best way to add the canonical tag, it is important that you follow a unified format on your website . If multiple people have access to the pages, then they could be adding tags in different ways, which could lead to even more SEO problems.

Add Canonical URLs Using Yoast

Yoast SEO is one of the most popular SEO plugins for WordPress, and it is a simple and easy tool for adding canonical tags. If you have a WordPress site, install the free plugin and easily add a canonical tag through the edit page or post section. This is an ideal option if you don’t want to touch the code or technical elements of your page.

add canonical url with yoast

Add Canonical URLs Using On-Site Code

Without a specific plugin that offers canonical linking (or if you just don’t want to use it for this purpose), you can add rel=canonical tags to your website using small code snippets. You can place the code in your page header to establish the canonical URL as soon as crawlers land on your page:

<link rel="canonical" href="inserturl.com<?php echo $_SERVER['REQUEST_URI'];?>">

If you aren’t familiar with adjusting the header code on your WordPress page, you can follow this guide to make sure you apply the code correctly.

Add Canonicals Through Google Tag Manager

If you have multiple tags on your website, then you can manage them through Google Tag Manager. This allows you to fire one tag when your page loads instead of dozens, improving the speed and making it easier to troubleshoot problems. Moz has an in-depth guide for managing your rel=canonical tags through GTM. You can use this tool to set different parameters for what can be crawled and what should be ignored.

add canonical url with google tag manager

Find Duplicate Content and Add Canonical URLs

Setting up a canonical URL is a quick way to fix SEO issues that come along with duplicate content on your site . Use a canonical URL checker to find and fix duplicate content issues on your site to make sure your content is optimized to attract and communicate properly with search crawlers.