I have a question. I am trying to use facebook comments plugin. has anyone here used it? when you install this plugin, all comments are displayed in an iframe, which is not accessible by search engine bots. Facebook suggests to grab the comments with a special PHP code and render them in the body of HTML page behind the comments box. That's the 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>"; ?> PHP: When I do it, all comments appear twice (obviously) on my page. First: normal comments box Second: huge line of comments that looks like: but 100 times longer. If I hide these rendered comments within a hidden div or use any other way to hide then from users while keeping them accessible by search bots, it will be considered a bad SEO practice and this URL will be most likely penalized. Do you have any idea what I should do? Anyone who actually used Facebook comments plugin rendered comments? How did you guys deal with this situation? Is hiding content indeed such a bad thing in terms of SEO? Thank you!
We need to see the logic. Is this AJAX or are you creating the HTML in the PHP? (It looks as if you have 2 places in the page that call the PHP file, once in the comments box and once somewhere else.)
Here's what I do. I have my http://example.com/page_one.php This is my HTML page with the content. I added FB comment plugin to the code of my page. <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://example.com/page_one.php" num_posts="10" width="500"></fb:comments> Code (markup): At this point comments are visible to the user but are invisible to search engines. Then I added the PHP code to the code of my page, just below the first code <?php $url = "http://example.com/page_one.php"; $request_url ="https://graph.facebook.com/comments/?ids=" . $url; $requests = file_get_contents($request_url); print "<PRE>"; print_r($requests); print "</PRE>"; ?> Code (markup): So now the comments appear twice. I placed the PHP code inside a div and I styled this div with CSS so that the comments look small but it's still wrong.
Run Firefox with Firebug and FirePHP. Add fb::log($requests); Code (markup): just before print "</PRE>"; (and the initial lines to get FirePHP loaded). Then you'll see what you're getting in $request and you can parse out what you need. Once it's clean, you can put it anywhere on the page you like. (And comment out the whole fb-root div.)
thanks, but I'm just not sure about the whole concept now. How can FB suggest something that creates double content on the page? Even if I only parse partial comments, it's still double content, which is not logical at all and confusing.
When you go to FB for the plugin code you need to fill in a webadress. What should I fill in to have a separate commentbox on each page. When I fill in my domain name it and comment on a page, then youll see the comment in the commentbox on every page. Thanks!