Is there a facebook button for each product?

1

I would like to put the facebook button on my site for each product, because when I click the button the product with your photo and characteristics may appear on the customer wall, what I have today is the button that likes the fan page facebook, I could not find any guidance or hint about it.

    
asked by anonymous 24.02.2015 / 14:51

1 answer

5

Yes, there is the Facebook like button documentation, there is attribute data-href where you can set the absolute URL of the page you are going to enjoy.

HTML5

<div class="fb-like" data-href="http://example.com/produtos/item-2" 
  data-layout="standard" data-action="like" data-show-faces="true" data-share="true">
</div>

XFBML

<html xmlns:fb="http://ogp.me/ns/fb#">
...

<fb:like href="http://example.com/produtos/item-1" layout="standard" action="like" 
 show_faces="true" share="true">
</fb:like>

<fb:like href="http://example.com/produtos/item-2" layout="standard" action="like" 
 show_faces="true" share="true">
</fb:like>

For the buttons to work, add this as soon as you open <body> (as suggested by the documentation):

<body>
<div id="fb-root"></div>

<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

<div class="fb-like" data-href="http://example.com/produtos/item-1" data-layout="standard" 
     data-action="like"  data-show-faces="true" data-share="true">
</div>
    
24.02.2015 / 15:35