Facebook comment plugin

5 replies
  • WEB DESIGN
  • |
Hello.
I decided to add a facebook comments plugin on my web site but I encountered the following problem.

According to Facebook specs:

The Facebook comments box is rendered in an iframe on your page, and most search engines will not crawl content within an iframe. However, you can access all the comments left on your site via the graph API as described above. Simply grab the comments from the API and render them in the body of your page behind the comments box. We recommend you cache the results, as pulling the comments from the graph API on each page load could slow down the rendering time of the page.
Further instructions tell you to add a PHP code to HTML page. The code grabs your comments and adds them to your page.

Code:
<?php 

   $url = "http: //developers.facebook.com/blog/post/472";

   $request_url ="https: //graph.facebook.com/comments/?ids=" .
        $url;

    $requests = file_get_contents($request_url);

    print "<PRE>";
    print_r($requests);
    print "</PRE>";

?>

As soon as I added this PHP code to the HTML of my page just below the comment plugin code, the comments appeared on the page in a single and very long line.
It looks like this but 100 times longer.

{"http:\/\/developers.facebook.com\/blog\/post\/472":{"data":[{"id":"10150090402026572_14446097","from":{"name": "Andy Mitchell","id":"501423231"},"message":"The new Facebook comments just launched and are pretty awesome!","created_time":"2011-03-01T17:06:28+0000"

So when the user lands on my page s/he sees both Facebook comments the way they are supposed to look and all the comments again in the format I showed above. It destroys the layout and just doesn't look right.

Obviously I did something wrong. These pulled comments have to be visible to search engines but must be invisible to the user. (Or not?)

Facebook says: "Simply grab the comments from the API and render them in the body of your page behind the comments box."

What does it mean "behind the comments box"?

How can I solve this problem?
I know that adding hidden content is SEO unfriendly.

I will appreciate any advice!
#comment #facebook #plugin

Trending Topics