tmort / Socialite

Other
1.68k stars 163 forks source link

Facebook like button resetting to 0 continuosly #88

Open mardet opened 10 years ago

mardet commented 10 years ago

You can see the problem in this url: http://brooklyn.lodgify.com

It shows 0 while it should be 1. This problem started a week ago, it was working before with the same code.

There are more details in stackoverflow if you want to contribute the answer there: http://stackoverflow.com/questions/23323678/facebook-like-always-reset-to-0

Thanks!

GwendolenLynch commented 10 years ago

@Durden81 does your initial HTML look something like this:

<div class="social-buttons cf">
    <a
        href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fbrooklyn.lodgify.com"
        class="socialite facebook-like"
        data-href="http://brooklyn.lodgify.com"
        data-send="false"
        data-action="like"
        data-layout="standard"
        rel="nofollow" target="_blank">
           <span class="vhidden">Like on Facebook</span>
    </a>
</div>

Emphasis on the sharer.php part in the href...

mardet commented 10 years ago

@GawainLynch thanks for replying. I have changed the HTML to be more similar to the one you provided:

 <div class="facebook">
        <a class="socialite facebook-like" rel="nofollow" target="_blank" href="http://www.facebook.com/sharer.php?u=http%3a%2f%2fbrooklyn.lodgify.com" 
data-href="http://brooklyn.lodgify.com" data-send="false" data-layout="button_count" data-width="135" data-show-faces="false">Facebook Like</a>
    </div>

but still doesn't work.. any other idea?

GwendolenLynch commented 10 years ago

Hmmm... The major difference I'm seeing in what we each posted is the classes on the wrapper div:

<div class="social-buttons cf">

I have put that URL into my staging site (hardcoded) and I get 1 like which matches the JSON I get back from Faceplant's API: https://api.facebook.com/method/fql.query?query=select%20%20like_count%20from%20link_stat%20where%20url=%22http://brooklyn.lodgify.com%22

mardet commented 10 years ago

I found the problem... in the end it was a problem with the fact that the page that was receiving the likes returned a 301 and not a 200. (no matter what is stated data-href the page being liked needs to give a 200 or facebook will give back 0 likes.) We changed the url once in our application and so we lost those likes. So in the end the problem wasn't with the socialite plugin. Thank you for your help!

GwendolenLynch commented 10 years ago

Excellent! No problems for lending a hand, that is what open source is all about :-)