facebook - Trouble with <fb:like> page title, like count, and page url -


i have set of pages in site using fbml method of inserting fb recommend button. problem every page on site shows exact same recommend count ("557 people recommend page" though installed button), , when i've tried recommend myself, shows in news feed wrong page title, wrong url, , of course, every recommend button on site incremented. here code:

og tags (i replaced these anonymous values protect client looking have idiot developer) ;) :

    <meta property="og:title" content="xxx page title"/>     <meta property="og:type" content="movie"/>     <meta property="og:url" content="http://abc.xyz.com/path/to/my/page/"/>     <meta property="og:site_name" content="xxx site name"/>     <meta property="fb:admins" content="xxx facebook id"/>     <meta property="og:description" content="xxx short description"/> 

...then inside body:

<body> <div id="fb-root"></div> <script>   window.fbasyncinit = function() {     fb.init({       appid  : 'xxxxx',       status : true, // check login status       cookie : true, // enable cookies allow server access 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 later on in page (the reason i'm using fbml method can track recommend events in google analytics -- should unrelated, purposes of full disclosure, i'm including code here too)...

<script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script>         <script type="text/javascript">             fb.event.subscribe('edge.create', function(href, widget) {                 _gaq.push(['_trackevent', '<?php echo $item->type ?>', 'facebook recommend', '<?php echo $item->title ?>']);             });         </script> <!-- fb button inserted here -->         <fb:like href="<?php echo urlencode('http://' . $_server['server_name'] . $_server['request_uri'] )?>" show_faces="false" width="450" action="recommend" font="arial" colorscheme="dark"></fb:like> 

the link shows in feed http://abc.xyz.com/path/to/my/ (the last segment of url missing), , title old one; realized pages had same title when setting up, , gave them different titles since. have run several of urls through url linter , there no errors, , data looks correct.

here 2 notes:

  1. since checked several urls using url linter , result came expected means it's caching problem, read this.
  2. if not using facebook graph api...or facebook related services other plugin, first facebook javascript initialization snippet not needed if it's used (<script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script>) not needed.

edit:
based on comments, of pages have more 50 likes means can't change title anymore:

you can update attributes of page updating page's tags. note og:title , og:type editable - after page receives 50 likes title becomes fixed, , after page receives 10,000 likes type becomes fixed. these properties fixed avoid surprising users have liked page already. changing title or type tags after these limits reached nothing, page retains original title , type.

source [editing meta tags].

but if need change title , okay of probably losing likes' count, can add fake parameter end of url meta tag facebook thinks it's new page:

http://www.domain.com/page.php?123 

please note i've never used technique new plugin.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -