Difference between rel="canonical" and og:url?

Will picture Will · Mar 20, 2013 · Viewed 25.3k times · Source

I'm having trouble understanding canonical URLs with regards to how search engines and Facebook seem to handle them.

My Google maps powered site allows visitors to use social media to request a gig in their country. One of the pages in question can be found at: http://izzy.nogig.in/

When a user clicks on their countries marker it gives them sharing options (twitter/facebook/etc), which when shared will share the URL specifically for that country, eg: izzy.nogig.in/usa? or izzy.nogig.in/spain? etc.

All of these countries in the URL amount to a lot of duplicate content so I use the following to point search engines to the page I want ranked:-

<link rel="canonical" href="http://izzy.nogig.in/_?"/>

For Facebook Likes to count towards each individual country I've set my Open Graph "og:url" as follows, eg:

<meta property="og:url" content="http://izzy.nogig.in/australia?" />

Now when I run a country-specific URL through the Facebook Object Debugger (eg. http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fizzy.nogig.in%2Faustralia%3F) it shows the following:-

Response Code:  206
Fetched URL:    http://izzy.nogig.in/australia
Canonical URL:  http://izzy.nogig.in/australia

Mismatch og:url and canonical url:
og:url tag in the header is not the same URL as rel='canonical' link in the html.

The above error is what's confusing me. I know they're mismatched, but I thought this was the correct way to do this.

Everything in the debugger looks good to me (correct link, description, image etc for each country), and I can't change the rel="canonical" value to match my og:url as I need it pointing to a single page (country-less) for search engines.

I believe it is all working correctly. Should I just ignore the error from the debugger, or have I set this up incorrectly? I don't want "likes" for each country all disappearing and counting towards the rel="canonical" URL.

Many Thanks - Will

Answer

Hamed Ali Khan picture Hamed Ali Khan · Jan 14, 2014

link rel="canonical" will be used by search engines where as og:url will be used by facebook

og:url basically tells the FB scraper "ignore anything on this page, and scrape this url instead"

More for Canonical link element: http://en.wikipedia.org/wiki/Canonical_link_element