rel=canonical

> > rel=canonical defined

Updated: March 16th 2016

What is rel=canonical?

  • Using rel=canonical defines a preferred url for search engines.
  • It improves link and ranking signals for content available through multiple URLs.
  • Canonical URLS resolve duplicate content issues.
several pages linking to one



Example use

<link rel="canonical" href="https://varvy.com/main.html" />

The above code is basically saying...

  • I am declaring a URL that this page should be indexed as
  • The url is "https://varvy.com/main.html".

Purpose

The main reason for rel=canonical to exist is to define a preferred url for search engines to index.

Why define URLs for search engines?

To get better rankings. A major way search engine will rank pages (urls) is by how many links point to that page (url).

googlebot observing page links

The basic issue rel=canonical resolves

In an oversimplified example we could imagine a web site that only has one page.

Let's say that website is at www.example.com and since it only has one page it seems like there should be no url issues right?

Wrong.

Here is a list of url variations that this site would be likely visible at.

  • http://www.example.com/
  • http://www.example.com
  • http://example.com/
  • http://example.com
  • https://www.example.com/
  • https://example.com/
  • http://www.example.com/index.html
  • http://example.com/index.html
  • https://www.example.com/index.html
  • https://example.com/index.html

Those are all urls that the page would be reachable from (and there are more).

Now let's consider a user who wants to link to the site.

The link they use could be anyone of the above variations.

How this affects ranking

If ten people linked to the page using ten different variations of the url, then each version would only have one link.

However, if you used rel=canonical then you would have ten links to one url rather than one link to ten urls.

Dynamic urls

If there is a page that sells socks it likely has a url like this...

http://www.example.com/socks.html

That page can likely be sorted by the colors of the socks available. If a user sorted the page for purple socks, the url would now look like...

http://www.example.com/socks.html?color=purple

In this scenario, we find that the sock page could have many different urls.

different version of a dynamic url

By using rel=canonical on the core html of that page there would no variation of the url from the eyes of a search engine.

It would know that those different sortable urls were really all the same page about socks.

The use of rel=canonical is now a best practice that is recommended by virtually every search engine and every search professional. I use it on every webpage of this site.

Where is rel=canonical used?

The use of rel=canonical is most often used by adding it within the head portion of your HTML.

Note: It can also be used as an HTTP header, but use in the header is not currently well supported.

Related






Patrick Sexton by