Error implementing facebook share

1

Here is the code I have:

<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/pt_BR/sdk.js#xfbml=1&version=v2.5";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Then some more code:

<meta property="og:title" content="<?php echo $titulorowimvtopo ?>" />
<meta property="og:description" content="<?php echo $descricaorowimvtopo ?>" />
<meta property="og:image" content="http://www.roteirodoimovel.com.br/cp/clientes/<?php echo $cliente ?>/<?php echo $idimovel ?>/<?php echo $idfototopoid; ?>" />
<meta property="fb:app_id" content="966242223397117" />

And finally the implementation for the share and enjoy button display:

<div class="fb-like" data-href="http://www.<?php echo $_SERVER["HTTP_HOST"]; ?>/detalhes.php?cliente=1&idimovel=6" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>

As you can see the code has PHP implementations to streamline the process, however on all pages the image, title and description are the same. What should not happen, since each page has its own title, image and description.

How to solve this?

    
asked by anonymous 22.12.2015 / 18:34

2 answers

2

When viewing the source code of the page are the data correct? you can use your own facebook tools to check for errors at a given URL.

link

    
23.12.2015 / 03:20
1

At the time of sharing that the same data always appears right? If it is, it must be because in div the data is static, not dynamic as in the meta tag. Is not that it?

<div class="fb-like" data-href="http://www.<?php echo $_SERVER["HTTP_HOST"]; ?>/detalhes.php?cliente=<?php echo $cliente ?>&idimovel=<?php echo $idimovel ?>" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>
    
22.12.2015 / 20:54