Mdermez
Mdermez

Reputation: 549

Usage of canonical URL

I am trying to set up og tags in order to share my sub-page on Facebook.

My subpage's URL is : www.example.com/subpage.html

The code for Facebook:

<meta property="og:title" content="some text">
<meta property="og:type" content="website">
<meta property="og:url" content="http://www.example.com/subpage.html">
<meta property="og:image" content="www.example.com/subpage.html/images/image1.jpg">
<meta property="og:site_name" content="some text">
<meta property="og:description" content="some text">
<meta property="og:image:width" content="470">
<meta property="og:image:height" content="246">

I am also using a canonical url which is :

<link href="http://www.example.com" rel="canonical">

So my question is: Should be property="og:url" the same with the canonical? If I test it on Facebook URL debugger as it is (above) then it will fetch the correct information. But it gives me the following warning:

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

If I change it and make it the same with the canonical then instead of information that was intended for the subpage it will fetch info that was intended for my homepage which is something that I don't want.

So do I have to leave it as it is?

Upvotes: 0

Views: 179

Answers (1)

ifaour
ifaour

Reputation: 38115

The debugger is simply following the conventions. The canonical url shouldn't be pointing to other pages unless they share the same content. Well, I'm oversimplifying it.

There are many sources online you can read about this. For example this article.

Upvotes: 0

Related Questions