Facebook fetch issue

Rajendrasinh Jadeja asked on October 30, 2017 08:29

Hi,

i have added html head webpart and set image and url in meta data for facebook but when i check in facebook then it shows fetched url and canonical url differ so how can i set same url in both?

Thanks and Regards, Rajendrasinh Jadeja

Correct Answer

Rajendrasinh Jadeja answered on October 31, 2017 03:01

Hi,

Thanx a lot for your support and below answers working for us

<meta property="og:title" content="{% CurrentPageInfo.DocumentName |(user)zbynekh|(hash)9624381b458312ac37a54938878ff7a2d9d1a473cfeb04e2b1e14f16068e737a%}" /> 
<meta property="og:site_name" content="Goodstart Early Learning_test" />
<meta property="og:url" content="{%CurrentDocument.NodeAliasPath|(user)zbynekh|(hash)0488d6c1d44cf5abb9061c6e5e31c2710bfd49adf3e0477ea747a6f5ed607e2d%}" />
<meta property="og:description" content="{% CurrentPageInfo.DocumentPageDescription |(user)zbynekh|(hash)980c7404bde53330c288f32dd1b203dc5434fa851cf22d0931c9c9d1cd3bb1e1%}" />
<meta property="og:type" content="web site1" />
{% foreach (doc in Documents.ClassNames("CMS.FacebookOG")) {
"<meta property='og:image' content='http://((domainname}}/getattachment/" + doc.AllAttachments.FirstItem.AttachmentGUID + "/attachment.aspx'" + "/>";
} |(user)zbynekh|(hash)e215bc558bb23d5abfc86ffebd477c843632c09e57a5bed2e28c689d2b676328%}
0 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on October 30, 2017 09:36

You will have set URL as canonical URL.

https://davidwalsh.name/canonical-link-rel

Reference for Open Graph tags - https://davidwalsh.name/facebook-meta-tags

0 votesVote for this answer Mark as a Correct answer

Rajendrasinh Jadeja answered on October 30, 2017 09:48 (last edited on March 24, 2018 12:16)

Hi Mr.Chentan

Thanx for your answer but i used below tag in html code under html head part.

{% foreach (doc in Documents.ClassNames("CMS.FacebookOG")) { "<meta property='og:image' content='http://example.com/getattachment/" + doc.AllAttachments.FirstItem.AttachmentGUID + "/attachment.aspx'" + "/>"; } |(user)zbynekh|(hash)7635d22d3c693519da74169845610ba7081a7d44510e263f245817fc9fd16b2a%}

so when i checked in facebook for developer then it shows fetch url perfect http://example.test.com.au but canonical url http://example.com like this.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on October 30, 2017 10:05

So in your code where are you setting canonical URL?

I am posting this from FB documentation

As a best practice, you should label all variations of a page with the canonical URL using an og:url tag (preferred) or link rel="canonical". The HTML for the canonical URL itself should also contain an og:url tag to designate itself as the canonical resource.

<meta property="og:url" content="https://example.com/path" />

What I can see from your code that you're setting only og:image tag and not og:url

Is there anything that I am missing?

Chetan

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.