Why does FB sharer use only the OG meta tag details on the home page? - facebook

I have a project, coded on codeigniter, which is basically a collection of posts by different users. While adding the fb share button and clicking on it, The image, title and description content is taken from the header of the home page and not of the page(view) where the share button is placed?

As mentioned here, The issue was that only those users could view the page who are signed in, and therefore even fb wasn't able to scrape the info from there.
EDIT: Whats important here is how FB scrapes the info. Apparantly the link you provide inside data-href if parsed by FB and they capture the og meta tags from the header on that page. However if you restrict those pages to logged in users, FB is also unable to parse the page and thus it reverts to the base URL's meta tags.

Related

Multiple share buttons that produce different content, within the same page, using Facebook OpenGraph Meta tags

I have a "single page" website. Let's call it "mySite.com/index.html".
There are several different places on my page that I would like users to share via Facebook. Each of these items should display a different image and headline text, when shared on the user's Facebook timeline.
Each of these item posts should link Facebook users back to my website, "mySite.com/index.html", when the posts are viewed from a Facebook timeline.
Example:
On my page, I wish to have two different share buttons:
A. ButtonA: This button would create a picture of an elephant on the user's Facebook timeline, with the headline, "A Beautiful Elephant!". This post on the user's timeline should link back to my page, when the post is clicked.
A. ButtonB: This button would create a picture of a tiger on the user's Facebook timeline, with the headline, "A Scary Tiger!". This post on the user's timeline should link back to my page, when the post is clicked.
The Problem:
My understanding is that in order to create Facebook timeline posts which contain attractive headline text and images, I must use Facebook OpenGraph Meta tags, on the same page that is being linked to. It seems impossible to have two different sets of Facebook meta tags on "mySite.com/index.html", one outlining the 'elephant' post, and the other outlining the 'tiger' post.
The only possible solution I can think of is this:
Create a special 'Facebook Meta HTML Page' for each post I want to make. Each 'special page would only contain the meta tags for the post I wish to outline. "mySite.com/elephant_meta.html"
The body of the special page would be blank. This will work, but there is a problem: The resulting Facebook post will link users to "mySite.com/elephant_meta.html", which is just a blank page. I wish them to be directed to "mySite.com/index.html".
Solution: Create a JavaScript redirect in the body of "mySite.com/elephant_meta.html". This redirect will take users to "mySite.com/index.html".
This will work, but it feels incredibly hacky. Is there a better way?
Still finding my way on the open graph stuff as well, but the way I understand it, you can set og:url to the url that you want users to go to when they click on the link in your story on facebook. So each of your meta pages could point back to your main site page using the og:url meta tag.

New method to accomplish the same functionality as the old Facebook sharer.php

The original method for sharing links with a custom image, text and link appears to have been stripped from Facebook. I for one would love to see them bring this back.
Here is my situtation. I have a Facebook tab that loads a page that is hosted under my hosteddomains.com. I setup a Facebook app to work with my Facebook tab. When I try to use the new "Share Dialog" if the link I want to share is not the same as the app domains then i get an error and I can't share the link. Am I doing something wrong or is this what they intended to do?
IF that's what they intended to do then there is no way that this will replace what sharer.php could do. I could be on any site and share any link with an image to Facebook and have it posted to my wall.
The question is if i am on facebook tab and i want to share a link (I want a dialog box with a custom photo, title, link, and summary) and allow my users to post this custom message to there Facebook status.
Maybe i am confused about how to accomplish this, but so far i am not having much luck.
I miss the good ole days when i could just construct a URL and that would give me the ability to share what i want to share. Twitter and Pinterest have these methods.
Here are some code examples of things that I've tried that did not work:
Option #1:
The url in this option goes to page that I created on hosteddomains.com that has the Open Graph Meta Tags in it. My idea was to share these pages from my server that will direct them back to my Facebook tab. The result I was getting from this method was seeing the title of the tab from my FB page and description. The reason turned out to be that if i set the og:url to my Facebook tab page, that's the page that would get scraped. That's not what i was expecting from this method. I thought it would take the meta tags from the page i shared and the url with it. Not take all of the info from url and ignore the meta tags.
<a href="https://www.facebook.com/sharer/sharer.php?u=[URL]"
target="_parent">SHARE ON FB</a></p>
Option #2:
Tried using Facebook Share Dialog. I had an interesting time with this one. I setup a new Facebook app. I tried the Facebook tab as the URL and also my custom url to the page that has custom open graph meta tags. The facebook app has two App Domains - hosteddomain.com and websiteA.com. I also created a Page Tab section. The page tab section loads the HTML page that was loaded in the tab we made for our facebook page. Issue with this method is I don't get a custom open graph options set from my php page. I'm picking up information from the facebook tab again. At least now the dialog box shows the name of the new app. I am limited in what i can share using this method. The url i share has to belong to the App Domains. In order to have multiple app domains, I had to make that Page Tab section and then add the second url to the App Domains field, otherwise i got a warning.
<a href="https://www.facebook.com/dialog/share?app_id=[appID]&display=popup&href=[url]
&redirect_uri=[url]&ref=s" target="_blank">SHARE THIS</a>
Option #3
The last thing I tried was the fb-share-button using the Javascript SDK. I get the same result as option #1. I don't think there is much difference between these two. Option 3 here is a bit easier to deal with and cleaner code. In this example, the url is to my custom page on hosteddomains.com that has my custom open graph meta tags. That doesnt seem to matter though. It still pulls the info from the og:url meta tag. I tried removing the og:url meta tag. I get the same result. Is it the Page Tab info interfering?
<div class="fb-share-button" data-href="[url]"></div>

facebook like/send button homepage domain not getting metadata

I added the like/send button on my homepage, http://www.website.com, for example.
But, when people like it or send it, it doesnt get the metadata, only when I post with the index page, like this: http://www.website.com/index.html
How can I resolve this? I want the link to be shared by people to be the .com one, but with the metadata from the index!
You can force facebook to update meta information by running the url in the Linter
see https://developers.facebook.com/tools/debug
The linter will scrape the page for meta tags, update facebook and show any errors related to the tags on the page.

Like button for Facebook page shows generic Facebook description in News Feed

I want a Like button on my web site that Likes my Facebook profile (rather than my web page), so that when a user clicks it they subscribe to my Facebook posts.
I've created the Like button using the tool at https://developers.facebook.com/docs/reference/plugins/like/
Further down that page there is an FAQ entry:
Can I link the Like button to my Facebook page?
Yes. Simply specify the URL of your Facebook page in the href
parameter of the button.
So, I've edited the href parameter to point to my Facebook page. eg:
https://www.facebook.com/myfacebookid
When a user clicks the Like button it has the desired effect. The user ends up having Liked my Facebook page. This is easily verified by the user going to my Facebook profile and checking that the Like button has changed to Liked.
But. When the user clicks the Like button, and entry appears in their News Feed with a generic Facebook description. ie:
Facebook is a social utility that connects people with friends and
others who work, study and live around them. People use Facebook to
keep up with friends, upload an unlimited number of photos, post links
and videos, and learn more about the people they meet.
I don't want a generic post about Facebook to appear. I want the description to relate to my Facebook account and/or web site.
Normally, I could modify this behavior with the Opengraph og: description tag, but as the page in the href is a Facebook page and not my own, I can't control the Opengraph tags.
I'm pretty sure that this was working okay before I enabled timeline for my account, so maybe this is a timeline bug?
So, how do I add a Like button which a) Likes my Facebook profile rather than one of my own web pages, and b) Posts a description of my Facebook profile rather than give a generic Facbook description?
Are all your fields in the info part of your page filled in, and/or completed? I just tested your theory and it seemed to work as expected, only thing is I know all fields in "info" are filled it. Give that a try.
This may happen if you have filled invalid/incomplete/wrong og tags in past and later changed them. Facebook's cache creates problem sometime.
Try putting all the entries (i.e. all og tags) and then debug them here http://developers.facebook.com/tools/debug. This debugger gives a detailed info about the url with og tags and also clears the cache for you.
This should solve the problem.
You have 3 important fields that used on page opengraph: Name,Description,Profile Image.
They are used when some one post your link on Facebook, or Google or some else web service that handle opengraph.
Actually, the suggested answers currently do not work and there is an open bug / ticket on Facebook for it. Up to now, there's no fix.
The problem is that you can not use simply https://www.facebook.com/myfacebookid. You should copy and paste the exact page URL. If you have a low number of likes it would look something like https://www.facebook.com/pages/[YourPageName]/[Your page Id]/, and this is the URL that you should use at this point.
If it does not work, try also https://www.facebook.com/[YourPageName]/[Your page Id]/.
In short, copy-paste the URL, do not type it manually.

Facebook Share doesn't pick up title / description meta tags that are changed after page load

Apparently Facebook Share doesn't pick up the title / description meta tags that are changed (via JavaScript) after the page load. It basically use the meta tags that are available upon load.
This is a simple example.
The link will change the title / description meta tags upon click. You can confirm that using Firebug.
Click the f|Share button: Facebook still always shows "A title that is available upon page load." and "A description that is available upon page load."
Anybody knows how to fix this?
This is a quote from Facebook. They scrape the page's meta tags when someone shares that page, and every 24 hours onwards (and not on page-load as you suggested). If you change the meta tags, you need to get FB to "lint" your page again using the URL Linter.
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around the site.
Facebook scrapes your page every 24 hours to ensure the properties are up to date. The page is also scraped when an admin for the Open Graph page clicks the Like button and when the URL is entered into the Facebook URL Linter. Facebook observes cache headers on your URLs - it will look at "Expires" and "Cache-Control" in order of preference. However, even if you specify a longer time, Facebook will scrape your page every 24 hours.
Source
Because the facebook server hits the URL you submit and looks for meta tags. It will always default to the original tags.
I assume that Facebook servers do not execute javascript when they scrape your page.
You could use server-side logic to detect the Facebook user agent and modify the outputted HTML accordingly.
According to the bottom of this page ( http://developers.facebook.com/docs/opengraph/ ), the user agent is currently:
facebookexternalhit/1.0
Its none of Facebook business. They just provide an api for it. And api takes meta tags as parameter. So you set your meta tags to facebook sharing.