Welcome to Geeklog, Anonymous Saturday, November 23 2024 @ 02:35 am EST

Geeklog Forums

Facebook Like Button in Articles not working


Mike

Anonymous
caffeinated
Hello, I'm trying to add a facebook like button in my articles and they're not working completely. People can like articles, and it's appearing on the page - (19 people like this), but the "likes" are not showing up in people's activity feeds, and I thought I might get some insight from someone here.

Here's what I'm doing. I created a FB app so I could get an app ID.

I included the FB JS SDK in the header.thtml file and added a namespace to the html tag per the FB instructions.

I then included the following in my storytext.thtml file:

<fb:like href="{article_url}" send="true" width="450" show_faces="false"></fb:like>

I also added some open graph meta tags to the header.thtml file.

Like I said, it "sort of" works, but doesn't add the likes to the FB timeline.

So, I went to the Facebook Debugger (http://developers.facebook.com/tools/debug), and got the following results:

Response Code: 400
Critical Errors That Must Be Fixed
Bad Response Code: URL returned a bad HTTP response code.

Any thoughts on why this Geeklog site is returning a 400 response code to Facebook?

I'm pretty sure this is why the "likes" aren't being added to timelines.
 Quote

Mike

Anonymous
Also - I should note, I'm using GeekLog 1.5.2.

Two additional notes:

1. I tested the site elsewhere (http://tools.pingdom.com) and it returned no 400 Response.

Server Response Codes
2XX Success
115

3XX Redirecting
14

4XX Client Error
0

5XX Server Error
0

Connection Error
0

2. I found the OAuth wiki page, but it looks like this may have been added to GL after 1.5.2.

Is this possibly the issue?

Thanks, Mike
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Here is the code used in purepro theme. Maybe it can help you.

Text Formatted Code
<div style="float:left;" 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/fr_FR/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
        <div style="float:left;margin-right:10px;"><fb:like href="{article_url}" send="false" layout="button_count" width="90" show_faces="false"></fb:like></div>


Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Mike

Anonymous
Thanks Ben. That is almost exactly the same code I'm using.

It seems like the Bad Response Code is preventing the "likes" from being posted to people's Timelines.

That is the mystery. Why is it returning a 400 Response when other online tools are not?

Is OAuth an issue? Anyone?
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Oauth is not the issue.
One of the Geeklog Core Developers.
 Quote

Mike

Anonymous
confused
Hi Laugh...thanks for chiming in.

Here's all the latest information.

The site is a custom php site with a Geeklog blog running GL 1.5.2. It was built by another developer years ago.

I added the Facebook Like to another page of the site that uses custom articles, and it works as expected. The Facebook Like js tells you when you've liked something, and it posts the Like to your timeline/activities.

Here's a page (not in Geeklog) where it's working correctly:
http://www.consortiuminfo.org/blog/considerthis.php?ct=67

The only area it's not working is within Geeklog. Here is the url of the Geeklog section:
http://www.consortiuminfo.org/standardsblog/

In this section, Facebook seems to be tracking all the likes correctly, but it's not posting them to anyone's timelines. After digging and digging, I came across the Facebook Debugger here:
http://developers.facebook.com/tools/debug

If you enter any non-Geeklog url from the site, it returns a valid response code...for example, the one from above: http://www.consortiuminfo.org/blog/considerthis.php?ct=67

If you enter any Geeklog url, it returns a "bad" response code...aka 400.
http://www.consortiuminfo.org/standardsblog/

So, it seems like the code on the page is running correctly, but before it gets posted to someone's timeline, this "bad response code" is preventing it from being added.

Another tidbit - other online tools are not showing any 400 response codes on the Geeklog pages, for example: http://tools.pingdom.com

Any other thoughts or ideas on this? I do really appreciate everyone who's chimed in...thanks. I'd love to put this one to rest.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
The issue seems to be related to the end of the urls
http://www.consortiuminfo.org/standardsblog/article.php?story=20130204095252396#.UUF8PFe3uqJ

#.UUF8PFe3uqJ


Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

ironmax

Anonymous
You may want to check bad behavior. Try temporarily disabling it while you do your testing. This is what I found while looking at your headers.

Text Formatted Code

HTTP/1.1 403 Bad Behavior =>
Date => Thu, 14 Mar 2013 07:53:34 GMT
Server => Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By => PHP/5.3.19
Connection => close
Content-Type => text/html
 


Its unclear if this is whats causing your problems, so its a guess.

Michael
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Good call Ironmax. The Bad Behaviour plugin is probably the issue.
One of the Geeklog Core Developers.
 Quote

Mike

Anonymous
Thanks IronMax for the idea. I disabled Bad Behavior2, and tried again. Still no love on the Facebook Likes, and even with that disabled, the Facebook Debugger still returns a "Bad Response Code" - 400.

I've looked at the header responses using a few online tools, as well as httpfox, a firefox plugin, and all are giving me 200 responses. What are you using to see the 403 response you posted?

Thanks again! Mike
 Quote

Mike

Anonymous
Also - Ben, I removed the # code being appended to the URLs. That was the Add This javascript adding that. I didn't think that was the issue because the Facebook Likes are working on other pages that have that as well. Thanks for the idea though.

I've posted here, posted to AddThis forum, and called the host for support. Everyone is stumped.
 Quote

ironmax

Anonymous
Quote by: Anonymous

Thanks IronMax for the idea. I disabled Bad Behavior2, and tried again. Still no love on the Facebook Likes, and even with that disabled, the Facebook Debugger still returns a "Bad Response Code" - 400.

I've looked at the header responses using a few online tools, as well as httpfox, a firefox plugin, and all are giving me 200 responses. What are you using to see the 403 response you posted?

Thanks again! Mike



Mike,

Have a look at HTTP/HTTPS Header Check and input your website url.

Ben maybe correct in that the ending part of the urls may interfer with how Facebook picks up the urls. Perhaps try reorganizing your url paths to not have the period in the file directory structure. At this point, its a guess.

Michael
 Quote

Trực Phạm

Anonymous
ensure that your code is running on valid domain instead of localhost?
 Quote

All times are EST. The time is now 02:35 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content