Reputation: 41919
When I click the facebook like button on one of my posts on my blog, it registers a "like" on every post on my blog. I am trying to get it so that if I click "like" on a post, it only works for that post in particular.
Do you see what I've done wrong? Thanks for your help, if you can
This is my html tag
<html xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
this is in my header. Note, it says "example.com" here, that's just because I didn't want to post my actual domain name. On my site, I use my real domain name there
<meta property="og:title" content="My example website"/>
<meta property="og:site_name" content="my example website"/>
<meta property="og:image" content="http://example.com/2011/pic-of-your-mama/"/>
<meta property="fb:app_id" content="app id"/>
<meta property="fb:admins" content="my facebook id"/>
This is going just after my body tag
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'myfacebookid',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
And this is what I have for the actual button
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=myappid&xfbml=1"></script><fb:like href="http://example.com" send="true" width="450" show_faces="false" font="arial"></fb:like>
Upvotes: 1
Views: 1275
Reputation: 3460
I'm not sure what blog platform you use, but if you're using Blogger, you can put this attribute expr:href='data:post.url'
in your fb:like tag. The expr prefix will analyse the value in the quote against the blog data.
So naturally your Facebook like tag would be like <fb:like expr:href='data:post.url' send='true' show_faces='true' width='450'/>
Upvotes: 0
Reputation: 16061
In your button there is:
<fb:like href="http://example.com"
I think you forgot to set a proper URL there (probably the URL of the blogpost you like).
Upvotes: 1