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 #%}" /> 
<meta property="og:site_name" content="Goodstart Early Learning_test" />
<meta property="og:url" content="{%CurrentDocument.NodeAliasPath#%}" />
<meta property="og:description" content="{% CurrentPageInfo.DocumentPageDescription #%}" />
<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'" + "/>";
} #%}
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 October 31, 2017 03:14)

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'" + "/>"; } #%}

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.