How to make Facebook display all the OG images? - facebook

I have created a gallery page, and I want to enable users to share it over facebook. To display the thumbnails I use OG images in the meta tag (dynamically adding them based on the link).
My problem is that when I share the link with the Javascript SDK as well as when I share the link by copy&pasting it to the timeline for the first time, Facebook will only display the first OG image.
If I copy&paste and link for the second time to a timeline (can be of another facebook user as well), it will display all the OG images, with a choice to navigate between them (left and right arrows), but same link shared with Javascript SDK for the 2nd, 3rd, nth time will still display only the first og image.
This is the relevant part of my page construction:
echo"
<meta property='fb:app_id' content='XXXXXXX' />
<meta property='og:title' content='My $VAR1 album' />
<meta property='og:type' content='website' />
<meta property='og:url' content='http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]'
<meta property='og:description' content='This is my album with my photos from $VAR1.' />
";
foreach($db->query("SQL QUERY") as $row)
{
echo "
<meta property='og:image' content='http://linktoimage_$row[0]' />
<meta property='og:image:height' content='350' />
<meta property='og:image:width' content='1200' />
";
}

There is nothing you can do about that; Facebook decides how to display it.
Btw., that you’re most likely creating an XSS vulnerability here (if that’s your actual code) is something you’re aware of I hope? (I am referring to the part where you output $_SERVER[REQUEST_URI] without any further checks or escaping/masking.)

Related

facebook share button not displaying content

Alright so I have set my meta tags exactly how it says on the facebook developer page, and the scraper even shows the data that will be showed to be correct, but when using the facebook share button on my website http://www.etdigitaldesign.com/, all that it shares is the website url, it doesn't include any of the information from the meta tags, that the scraper says it should. No site name, no description, no image. just the website URL.
This is really confusing to me because the scraper says the share button should be showing the proper info, and I'm using a copy/pasted code snippet from the fb developers page, so I can't see what my error could possibly be...
here is what the scraper shows:image at http://i.imgur.com/zNIyhfg.png since I can't post images yet.
and here's my meta code:
<meta property="og:url" content="http://www.etdigitaldesign.com" />
<meta property="og:type" content="website" />
<meta property="og:title" content="ET Digital Design" />
<meta property="og:description" content="Currently doing a grand opening special, making several free websites to get my name out there. Visit the site if you are interested!" />
<meta property="og:image" content="http://www.etdigitaldesign.com/images/etlogobig.png" />
All facebook's examples have self-closing meta tags, so try that and then re-scrape, if that still doesn't work add a fake parameter eg http://example.com/?20 and scape
At the moment the title and image are showing, just not the description. It shows HHTP status 206,which is partial content, but that's not a problem

Facebook Share not finding og:image tag

I'm trying to figure out how the Facebook share protocol is getting the images it is.
Example article: http://www.startribune.com/sleepy-eye-quads-celebrate-65th-birthday/302364361/
As of right now (8 May 2015 1:00pm CDT), plugging that URL into https://developers.facebook.com/tools/debug/og/object/ it gives the following warning: og:image was not defined, could not be downloaded or was not big enough. Please define a chosen image using the og:image metatag, and use an image that's at least 200x200px and is accessible from Facebook. Image 'http://stmedia.stimg.co/obed021814.JPG?w=600&h=600' will be used instead.
However, further down on the page in the 'Based on the raw tags, we constructed the following Open Graph properties' part of the page, it clearly shows the correct image that is in the og:image tag that is on the page.
Why would Open Graph think og:image is not defined or not be able to access the image when clearly farther down the page it can find it?
The meta tags within the header are as follows:
<link rel="canonical" href="http://www.startribune.com/sleepy-eye-quads-celebrate-65th-birthday/302364361/" />
<meta property="og:url" content="http://www.startribune.com/sleepy-eye-quads-celebrate-65th-birthday/302364361/" />
<meta property="og:title" content="Sleepy Eye quads celebrate 65th birthday" />
<meta property="og:site_name" content="Star Tribune" />
<meta name="news_keywords" content="" />
<meta name="description" content="The Sleepy Eye quads have returned to their childhood home in southern Minnesota to celebrate their 65th birthday." />
<meta property="og:description" content="The Sleepy Eye quads have returned to their childhood home in southern Minnesota to celebrate their 65th birthday."/>
<meta property="og:image" content="http://stmedia.startribune.com/images/1430701562_10026501+Quads+Birthday.JPG" />
</head>
It's always good to run all links related to a page in the Facebook Debugger as mentioned by #CBroe.
As for issues with images specifically, I would also recommend you add the og:image:width and og:image:height meta tags if possible to help the crawler crawl your image as per this doc.
If you have other pages facing the same issue, I would supplied the mentioned tags before trying to run the image url itself in the debugger and see if that helps.

Change photo for facebook like pop up window

Just add Facebook like button into my website. After clicking it, a window pop up to let user input comments and with the text content from my website. There is no problem for it after I input correct site URL. However, the photo in the pop up windows is still the default one (like a sun). How do I replace it with the photo of the logo of my website?
Add og tags to your url. Here's the doumentation for the same.
You just have to add some meta-tags:
<meta property="og:title" content="{title}" />
<meta property="og:image" content="{img_url}" />
<meta property="og:description" content="{description}" />
<meta property="og:caption" content="{caption}" />
and so on..
You can also check if the og:tags are read by facebook properly or not in Debugger, just put your url in there and facebook will show you the tags or show errors if any.

facebook scraper sees different meta tags than source

I'm trying to customize image, page title, and description data for facebook share feature on my page. When I view the og meta tags in the source of my page, I see the correct info
<meta property="og:title" itemprop="name" content="You got an A!" />
<meta property="og:description" itemprop="description" content="Find out how much you know about the Hittites at MYQUIZPAGE" />
<meta property="og:image" itemprop="image" content="http://PAGE/MYPAGE/MYIMAGE.jpg" />
However, when I plug the url into the facebook debugger, I instead see details of the parent site.
I dont know why this is, as the correct info is sent in the header, NOT appended afterwards or anything like that.
Im using the following anchor for the share button(wihch I have used many times in the past without fail)
<a href="//www.facebook.com/sharer/sharer.php?u=MYURL" target="_blank">
One more detail- the content of the og tags on my page depends on values in the url query string.
Any ideas as to what is going on?

Facebook sharing not displaying meta data unless url passed through debugger

I have a strange problem with Facebook sharing. I have a news portal and when I try to share some news, half of them are sharing fine, and half are not recognized at all, just the link is shared without Title, Image and Description.
The news portal is in PHP Codeigniter, and here are the meta tags that every news link has, and they are correct when I see Page Source.
<meta property="fb:app_id" content="the number"/>
<meta property="og:url" content="the full url of the page" />
<meta property="og:title" content="Title of the news story" />
<meta property="og:description" content="The introduction of the story" />
<meta property="og:image" content="full link of the image"/>
I checked there isn't anything common for the stories that Facebook does not take the meta data. I tried with everytype od image, and with many different resolutions, even with the minimum resolution 200x200 but there is no success.
The only solution is to put the link in the Facebook debugger and then it is working fine. After that you can share it normal, but this is wasting of a lot of time and energy to put half of the links in the debugger before sharing...
What am I missing here?