Facebook Comments SEO: Calling all SEOs & Web Developers!

At the beginning of March, Facebook launched their new and improved Comments Box plugin. According to Facebook:

“Comments are easily shared with friends or with people who like your Page on Facebook. If a user leaves the “Post to Facebook” box checked when she posts a comment, a story appears on her friends’ News Feed indicating that she’s made a comment on your website, which will also link back to your site.


Friends and people who like the Page can then respond to the discussion by liking or replying to the comment directly in the News Feed on Facebook or in the Comments Box on your site. Threads stay synced across Facebook and on the Comments Box on your site regardless of where the comment was made.”

Facebook Comments are bad for SEO (right now)

Adding user comments to a page is typically a great enhancement for SEO and something we commonly recommend so I was excited to see this announcement. However, I found that Facebook Comments are currently blocked from search engines because they are displayed in an <iframe> or in JavaScript. There is currently no way to directly integrate FB comments within the HTML code where search engines could read and index the comments.

SEOs & Web Developers: Let’s solve this issue!

From my research, it appears that Facebook does allow developers to access Comments so there should be a way to create a solution that also works for SEO. But they do not currently offer a simple solution or any examples of how to go about it.

According to Facebook’s FAQ, the comments for every URL can be accessed via the graph API. Simply go to: https://graph.facebook.com/comments/?ids={YOUR_URL}.

For example: https://graph.facebook.com/comments/?ids=http://developers.facebook.com/docs/reference/plugins/comments.

So my call to SEOs and Web Developers, what can we do as a community to solve this issue?

Point It About the author
  • So after talking with a friend (hi Craig!), it sounds like the direction we need to go is to add a server layer that can interface directly with Facebook’s Open Graph API. The server code needs to pull in the comments for a page and then display them in the page code.

    Anyone able to submit a proof of concept code design?

    March 25, 2011 at 8:58 am
  • Yes, you can do that using the Facebook SDK and Graph API. Publish new comment then retrieve it once it’s published. This hasn’t been fully tested but I bet it will work.

    $facebook->api(‘/COMMENT_ID/comments’, ‘post’, array(‘message’=>’NEW COMMENT’, ‘access_token’=>$session[‘access_token’]));

    $json = file_get_contents(‘https://graph.facebook.com/COMMENT_ID/comments’);
    $comments = json_decode($json);
    foreach($comments as $comment)
    echo $comment[‘message’];

    You could use jquery to GET the graph api for comments asynchronously.

    Also, to publish, the code above is assuming you’ve already set up the Facebook SDK (PHP).

    And it’s 5am….and my eyes are barely open so I am sure there are typos…goodluck.

    April 1, 2011 at 12:46 am
  • Hi Clifton,

    Thanks so much for your help! I’ll test out this code to see how it works and follow up with you to let you know how it goes.

    Assuming this works well enough to publish widely, I’ll make sure you receive proper credit for your work.

    Thanks again,

    Ben Krull

    April 1, 2011 at 8:28 am
  • Hey Ben,

    Did you see Facebook’s update on the comments plugin? Check it out: http://developers.facebook.com/blog/post/490

    They’ve made it easier to pull comments from the graph (based on your URL) and even give a php code example on how to print those comments in HTML.

    Still – seems like you would want to hide this inside a “noscript” tag or something…so the people w/ JS can see and use the FB functionality, but only those w/o (and search crawlers) would see the static comments.

    You know?

    April 20, 2011 at 8:02 am

Leave a Comment: