What is a Canonical tag?
To be simply a canonical tag is an HTML tag used to show the search engines that similar URLs are actually the very same page. The canonical tag is then added to pages using a link element in the HEAD of the HTML document.
If two URLs contain the same canonical tag this indicates to search engines to index the pages as a single entry.
For example take the following URLs:
Technically, these are the same exact place, meaning they all pull up our KB home page despite having different URLs. To Google and other search engines these all would be indexed and crawled as individual pages, even though they’re all the same exact content.
Enter the Canonical tag!
Using the canonical tag, we can show to search engines that all these different URLs serve the same resources or page. Continuing with our example the canonical page used would look like:
With this Meta tag included in our documents HEAD, then we should see all of the example URLs indexing as the same page.
Exactly what does a Canonical tag do?
Canonical tags specify for Search Engines what the ideal URL to index a page our resource is. Like most other HTML meta tags, how a user interacts with your website is not directly affected by the canonical tag. It just enables you signal to search engines what your preferred URLs are.
Why should I use Canonical tags?
Canonical tags should be used whenever you’re serving the same content from multiple URLs. The affected URL variations include changes to: protocol (http vs https), query parameters, and (of course) URL structure. Implementing Canonical tags is especially useful when serving the same content over various URLs. Usually, this is known as the “Duplicate Content” problem when looking into a websites SEO performance.
Additionally, in the case of URLs with query parameters, it helps ensure that search engines only index a page with the “cleanest” form of the pages URL. This can help prevent pages with query parameters from being indexed separately from your main page.
To 301 redirect, or to Canonical; that is the question.
If you are familiar with the SEO topic, you will understand how important it can be to redirect your URLs properly. So you might be wondering, “Why not just redirect these pages?” and that’s a great question! If you ever have the option you should always add a redirect. Think of canonical tags as a way of clearing up a potential ambiguity (if the same content is visible on two pages), where as a 301 redirect removes any potential ambiguity. That said, basically you should always aim to include Canonical tags since they help cover URL variations based on query parameters as well.