Search code examples
facebookfacebook-like

facebook like button displaying incorrectly (debug shows empty href)


I'm having an issue with the facebook like button on website: according to the facebook lint tool my like buttons are: <div class="fb-like" data-href="" data-send="false" data-layout="button_count" data-show-faces="false"></div>

however my page has: <div class="fb-like" data-href="<?=$value['actions'][1]['link'];>" data-send="false" data-layout="button_count" data-show-faces="false"></div></p><hr /> and I'm 100% sure that $value['actions'][1]['link'] actually contains a valid facebook URL (when looked at my page without re-rendering, it also shows this URL)

-

With this output you'd expect the like not to function, however it does:

if I like a status message, it tells on the page that I liked it, and it is the first like for that item;

however if I go to facebook, it states that I liked it, and also states that there are x other likes.

If I refresh the page, it's again like I didn't like the item yet; altough it's the same item

-

I hope you understood my problem, isn't that easy to explain...


Solution

  • First, remove the loading of the Facebook scripts and check your view source to ensure the data-href is populating correctly prior to the Facebook parser getting to it.