0

I am trying to share video link using Facebook share dialog but after sharing the url on Facebook, Facebook does not show the image and also does not play video on the Facebook after sharing it.

I am trying to share links like how YouTube share their videos on Facebook so that user can play the videos on the Facebook after sharing it. Here is my code

FB.ui(
    {
        method: 'share',
        quote: 'share it using facebook',
        mobile_iframe: true,
        href: 'https://example.com/raisingfundsthroughvideo',
        hashtag:'#websitename',
    }
);

in my meta tags i have also used the image width and height but still the image is not showing.

<meta property="og:image:type" content="image/jpg" /> 
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />

facebook link debugger gives me this error on its page

Provided og:image, https://d3ekuwxfrjk8w6.cloudfront.net/folder/folder/filename could not be downloaded because it exceeded the maximum allowed sized of 8Mb or your server was too slow to respond.

the above image url is valid and I don't know why it is not showing the image is it because of the Cloudfront url?

1 Answers1

1

I use cloudfront as well and at least for the thumbnail preview that you see after sharing a URL on the share dialog, I know that it must be an image served from the same website URL and the index.html has this:

<meta property="og:url" content="http://example.com/"/>
<meta property="og:image" content="http://example.com/assets/thumbnail.png"/>

And yes, you must comply with the size limits of the thumbnail image.

Update: The URL you provide in "og:image" has to be publicly visible which means that if you copy, paste and visit that URL on a new browser window you should see the thumbnail image.

In this example you would need to have an S3 bucket called example.com which has the content of your site and another one www.example.com which is empty but is setup for Static Website Hosting which redirects to example.com. Your cloud front needs to have be setup as follows:

  • origin: example.com.s3.amazonaws.com
  • cname: example.com, *.example.com (so that www.example.com works)

Go in your cloudfront distribution and click Edit you will see a place to enter the CNAMEs and enter example.com *.example.com and save the changes.

Click on the Origin tab and setup an origin as follows: Origin Domain Name: example.com.s3.amazonaws.com Origin ID: s3-example Origin Type: S3 Origin

Then wait until after cloudront re-enables your distribution.

fv_dev
  • 101
  • 6
  • Sorry for the late reply the images size is 10 to 30 kb max but all of my images are on the amazon s3 so can you please suggest me how can i add my example.com in the cloudfront url so that facebook picks up my images from cloud front. – Muhammad Usama Mashkoor Jul 30 '17 at 18:32
  • My images are generating dynamically that is why they are stored on amazon s3 can you please suggest a way where i can get facebook to show my images from the s3 when i am sharing them. Thanks in advance. – Muhammad Usama Mashkoor Jul 30 '17 at 18:34
  • 1
    I updated my answer with additional info regarding your cloudfront URL. – fv_dev Jul 30 '17 at 19:24
  • can you please give me details on how can i setup my cloudfront to use the above cnames like you have mentioned i am new to amazon so it will be really appreciated sorry for the trouble. – Muhammad Usama Mashkoor Jul 30 '17 at 19:42
  • Updated. Hope that helps you! Good luck. – fv_dev Jul 30 '17 at 20:10
  • Thanks let me try it.. :) – Muhammad Usama Mashkoor Jul 30 '17 at 20:38
  • i have setup cdn.example.com to access amazon s3 bucket files and i am using amazon s3 signed urls but it giving me this error on facebook link debugger 'og:image:url' could not be parsed as type 'url'. – Muhammad Usama Mashkoor Sep 09 '17 at 04:59
  • here is my url https%3A%2F%2Fcdn.excideo.com%2Fchallenge-explainer%2Fthumbnail-images%2F434behvm2vew-434o1meckvm8%3FExpires%3D1504940274%26Signature%3DqANw7%7Ek59Nlll-iBEXekXcJakt-kMjhBg8ZWwAF6IhE1QJckVqSHoL7Fp7DWJmRaDyVvhh-42CP3sVRAalVS%7E4AEtLtcJoqi1Uh%7E2Wqp8-taqHi0pawRS0I9AD2SpDId37nfmNAqVy5tWFi0O0uJSdgEvdz8q6wl%7Eb8FWVtIoX0al37gzAW8TuJC9viatZ9ez6qzh0Hg12Q1Mol7nUe1kvCL4opEPZflNNXP5rdEKL9JbK3G5NJo4vVQIp0ONGnJF0EiH5YAQkQHyp%7EdiZLil899Z1PNiAz%7Ebm6VP%7E09eTvco9TyVivUJDDqeGTnykNg3G7p%7E2zZ-RdBLi3ZrrdnDQ__%26Key-Pair-Id%3DAPKAI33C6BDMY4E5KYJA – Muhammad Usama Mashkoor Sep 09 '17 at 04:59
  • That URL has encoded asciii characters and facebook wants the real un-escaped URL. See : https://www.w3schools.com/tags/ref_urlencode.asp in other words the more readable url version which would end up looking something like this: `http://example.com/assets/thumbnail.png` – fv_dev Sep 10 '17 at 01:31