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?
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.
Related
I need to share an image from my webpage to Facebook.
I've looked at Facebook's dev pages, and it you need to add meta data to your page - you may specify an image - this will then be shared.
The problem is I have a number of images on my page.
Is it possible to share specific images - where should I be looking in the api?
If you have a bunch of images and want to select a particular one during sharing, then you can add multiple og:image tags - one for each image.
<meta property="og:image" content="http://image1.jpg">
<meta property="og:image" content="http://image2.jpg">
<meta property="og:image" content="http://image3.jpg">
...
Once you do this, on sharing, the user will be able to select from one of these images.
Also after you add these tags, make sure that you force a re-scrape to update your OG object: pop your url into the URL Debugger and 'Fetch new scrape information'.
I have a single page angularjs web app. I'm trying enable it to be crawlable by search engines. To achieve this I'm using prerender.io, a nodejs webserver with a phantomjs browser to render ajax pages.
I am basing my nginx config off the following gist: https://gist.github.com/Stanback/6998085
This works for the most part. I can curl my app and get the correct response: curl -o test.html domain.com/?_escaped_fragment=/path
The request is redirected to the prerender.io proxy and the proxy makes a single request with the following url: domain.com/#!/path
All other requests (js, img, css and xhr) pass through nginx as normal. Phantomjs has no trouble rendering the proxy request after waiting for the following JS variable to be set to true: window.prerenderReady = false;
This is all great... Google can crawl my website! Enter Facebook.
I'm setting a number of OG metatags so that I can use the Facebook like button (iFrame). The following metatags are set for each page:
<link rel="canonical" href="http://domain.com/#!/asset">
<meta property="og:url" content="http://domain.com/#!/asset">
<meta property="og:type" content="website">
<meta property="og:image" content="http://domain.com/image.jpg">
<meta property="fb:app_id" content="xxx">
<meta property="og:description" content="foo">
<meta property="og:title" content="bar">
<meta property="og:site_name" content="domain.com">
These metatags are updated correctly by angularjs for each asset and the phantomyjs proxy correctly waits for them to be updated before returning the response.
However when I test the URL http://domain.com/#!/asset with the Facebook URL linter I get some problems.
Facebook claims that the canonical URL and the og:url differ, however when I click "See exactly what our scraper sees for your URL" they are idential
When I click "See exactly what our scraper sees for your URL" the canonical and og:url have been replaced with domain.com/?fb_locale=en_GB#!/asset
The proxy receives 3 requests. The first for the asset then it seems it follows the canonical and og:url
When a user clicks the Like this page iFrame the link back to my website looks like domain.com/?_escaped_fragment_=/asset
Number 4 is the issue that is a deal breaker. If a user likes a page on my post it goes into their Facebook activity stream. If that user then clicks on the link back to my site in their stream it will direct them through the proxy and render the page through phantomjs!
I'm guessing that I shouldn't be sharing the links with the hash-bang through Facebook. I think I should be sharing a link and setting the canonical / og:url to something like domain.com/static/asset. The nginx config should be updated to catch /static urls, if useragent = Facebook or params contain _escaped_fragment_ then direct to proxy else redirect the user to #!/asset.
I have tired all that I can think to get a modified nginx config to work with this however it has beaten me. When I intercept those /static urls and rewrite to the proxy randomly image, css and js assets are requested through the proxy and phantomjs crashes.
Could someone please help me modify this nginx config so that I can forward web crawler requests to the proxy, allow facebook to scrape the correct og tags off my site AND have the correct link-back url specified when users share my content on Facebook?
Did you figure this out yet? Facebook doesn't do a very good job with #! urls. This StackOverflow answer does a good job explaining it: How to handle facebook sharing/like with hashbang urls?
When a user is on a page on your site (http://domain.com/#!/asset) and does a sharing action on your website, it should share the canonical url http://domain.com/asset.
Then if a user visits http://domain.com/asset, you just redirect them to http://domain.com/#!/asset.
And if Facebook accesses the canonical URL (http://domain.com/asset), then redirect it to your Prerender.io server.
Or...just switch from #! to html5 pushstate, and you won't have to do any of the #! redirecting for Facebook. That way the proxy becomes more simple, so you'd always just proxy any request from Facebook to your Prerender.io server
I have a share button on my site (I use AddThis tool)
and Open Graph meta tags with article as a type:
meta property="fb:app_id" content="No"
meta property="og:image" content="LogoUrl"
meta property="og:image:type" content="image/jpg"
meta property="og:image:width" content="200"
meta property="og:image:height" content="500"
meta property="og:url" content="LogoUrl"
meta property="og:title" content="title"
meta property="og:type" content="article"
My url looks like that: [mySite]/9095210/1811, so for every different url, I insert different thumbnail, title and description.
My images are from an absolute url.
The problem: I see the details in facebook share preview window, only after the second time I click on the share button. On the first time the facebook share window appears, but without any details. If I continue and share the link in the first time (as in the times after) I see all the details in my facebook. So, the problem in only in the facebook share preview window.
Anyone meet this problem already, and maybe can help?
I had the same problem, and the solution was the next:
You need to create an application in the facebook developer area: https://developers.facebook.com/apps
And need to put the application id to the the fb_init just like this:
js.src = "//connect.facebook.net/hu_HU/all.js#xfbml=1&appId=YOUR_APP_ID";
After providing the correct appliaction id, my problem has been solved.
A similar issue is explained in the "facebook for developers" in sharing , best practices
Pre-caching images.
When content is shared for the first time, the Facebook crawler will scrape and cache the metadata from the URL shared. The crawler has to see an image at least once before it can be rendered. This means that the first person who shares a piece of content won't see a rendered image.
There are two ways to avoid this and have images render on the first Like or Share action:
Pre-cache the image with the Sharing Debugger
Run the URL through the URL debugger to pre-fetch metadata for the page. You should also do this if you update the image for a piece of content.
Use og:image:width and og:image:height Open Graph tags
Using these tags will specify the image dimensions to the crawler so that it can render the image immediately without having to asynchronously download and process it.
The third way, which is the way we do it, is to put in the link, and facebook responds with "fetching a preview" , close it and re-post. This works very well.
I hope that I understood your problem correctly and that this helps you.
I've created a simple Iframe app and attached it as a tab on my fanpage.
On this page I have a classic share link:
http://www.facebook.com/sharer.php?u=http://www.fb-iframe-app-url.com">SHARE IT NOW!</a>
The iframe app is hosted on my server and here ive defined what usually works for images:
<meta property="og:image" content="http://domain.com/image.gif" />
However it seems all this kind of data, is fetched from the fanpage itself - which means I cant control those elements.
Do anyone have experience with customizing share thumbnail and text from within an iframe app-clicked share url?
I am using Facebook Send button in 3 pages of my website. Before i send the message, the title, website and description looks fine. After i send, it shows up different title and different description in the message . I have no idea what's wrong in here? Is that my mistake somewhere or cache issue or something else?
Thanks a lot in advance!
Facebook has a tool called URL Linter. This tool gives us an idea about how a url will be shared on facebook, what content, which image will be fetched. We can use this tool for any url and it fetches the latest title, description, excerpt and other stuff that will be shown while sharing the link. If you use an already shared URL with this tool then facebook fetches the latest content, and also updates it cache with the latest content.
https://developers.facebook.com/tools/debug
At first you have to cross check and confirm that the url shared is of the right page, not the simple domain address. It will be better to cross check the following contents inside <Head> tag to make sure that you have done basic code requirements.
<link href="{URL OF THE PAGE}" rel="canonical">
<meta content="{YOUR FB APP ID}" property="fb:app_id">
<meta content="{YOUR PAGE TITLE}" property="og:title">
<meta content="website" property="og:type">
<meta content="{URL OF THE PAGE}" property="og:url">
<meta content="{LOGO IMAGE URL}" property="og:image">
<meta content="{YOUR SITE NAME}" property="og:site_name">
Once this is done, it should mostly resolve your issue with different title and different description.
If you still face issue, go to https://developers.facebook.com/tools/debug
Input URL or Access Token and click DEBUG button. It will guide you if there is any errors in the in accessing the page by facebook.
Hope this helps.