Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
    • Like Button
    • Send Button
    • Follow Button
    • Comments
    • Activity Feed
    • Recommendations Box
    • Recommendations Bar
    • Like Box
    • Login Button
    • Registration
    • Facepile
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Plugins
    • Activity Feed
    • Comments
    • Facepile
    • Follow Button
    • Like Box
    • Like Button
    • Login Button
    • Recommendations Bar
    • Recommendations Box
    • Registration
    • Send Button
    • Share Dialog
    • Shared Activity
    • fb:name
    • fb:profile-pic
  • Beta Plugins
    • Migrations
      • Subscribe Button

    Comments

    After the July 2013 migration, the Send Button will require an absolute URL in the 'href' parameter.

    Comments Box is a social plugin that enables user commenting on your site. Features include moderation tools and distribution.

    Social Relevance: Comments Box uses social signals to surface the highest quality comments for each user. Comments are ordered to show users the most relevant comments from friends, friends of friends, and the most liked or active discussion threads, while comments marked as spam are hidden from view.

    Distribution: 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.

    The mobile version will automatically show up when a mobile device user agent is detected. You can turn this behavior off by setting the mobile parameter to false. Please note: the mobile version ignores the width parameter, and instead has a fluid width of 100% in order to resize well in portrait/landscape switching situations. You may need to adjust your CSS for your mobile site to take advantage of this behavior. If preferred, you can still control the width via a container element.

    (?)
    (?)
    (?)
    (?)
    light
    • light
    • dark
    Get Code

    Attributes

    • href - the URL for this Comments plugin. News feed stories on Facebook will link to this URL. Note: After July 2013 migration, href should be an absolute URL.
    • width - the width of the plugin in pixels. Minimum recommended width: 400px.
    • colorscheme - the color scheme for the plugin. Options: 'light', 'dark'
    • num_posts - the number of comments to show by default. Default: 10. Minimum: 1
    • order_by - the order to use when displaying comments. Options: 'social', 'reverse_time', 'time'. Default: 'social'
    • mobile - whether to show the mobile-optimized version. Default: auto-detect.

    Moderation tools

    Admins can choose to make the default for new comments entered either “visible to everyone” or “has limited visibility” on the site (i.e., the comment is only visible to the commenter and their friends), to help mitigate irrelevant content.

    Admins can also blacklist words and ban users. If a new comment is published from a banned user or contains a blacklisted word, this comment will automatically have limited visibility.

    To moderate, you need to list yourself as an admin. To do this, simply include open graph meta tags on the URL specified as the href parameter of the plugin. These tags must be included in the <head> of the document. Include:

    <meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID}"/>
    

    To add multiple moderators, separate the uids by comma without spaces.

    If your site has many comments boxes, we strongly recommend you specify a Facebook app id as the administrator (all administrators of the app will be able to moderate comments). Doing this enables a moderator interface on Facebook where comments from all plugins administered by your app id can be easily moderated together. You can choose to specify either fb:app_id or fb:admins, but not both. This tag should be specified in the <head>.

    <meta property="fb:app_id" content="{YOUR_APPLICATION_ID}"/>
    

    You can moderate comments from just this plugin inline. If you have specified your app id as the admin, you can moderate all your plugins at http://developers.facebook.com/tools/comments.

    When you implement multiple comments boxes on your site and tie them together using an app_id, the moderation settings you choose will apply to all your comments boxes. For example, changing the moderation setting to 'has limited visibility' will affect all comments boxes under the same app_id. If you need to apply different moderation paradigms in different areas of your site, you should use two or more app_ids. You may then apply different moderation settings each group of comments boxes.

    FAQ

    How do I access the number of comments left of my page?

    The fb:comments-count tag will emit the number of comments on your URL in a <span> tag. You can then style this however appropriate to match your site. Note this is currently not available in HTML5. For example, to show the number of comments on example.com:.

    <fb:comments-count href=http://example.com/></fb:comments-count> awesome comments 
    

    Will emit:

    awesome comments

    You can also load an iframe from Facebook which will display the number of comments with a link to your URL. For example, this shows the number of comments for example.com.

    <iframe src="http://www.facebook.com/plugins/comments.php?href=example.com&permalink=1" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:16px;" allowTransparency="true"></iframe> 
    

    The number of comments left on a particular URL can be accessed via the Graph API. For example, the number of comments on example.com is the 'comments' field of: https://graph.facebook.com/?ids=http://example.com/.

    You can also use the comment FQL table.

    How do I know when someone comments on my site?

    You can subscribe to the 'comment.create' and 'comment.remove' events through FB.Event.subscribe.

    What does the grammar filter do?

    • Adds punctuation (e.g. periods at the end of sentences)
    • Trims extra whitespace
    • Expands slang words (e.g. plz becomes please)
    • Adds a space after punctuation (e.g. Hi,Cat would become Hi, Cat)
    • Fix common grammar mistakes (e.g. convert ‘dont' to ‘don’t’)

      You can enable the grammar filter from the settings section of the plugin.

    How do I access the comments left on my site?

    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, the comments on this URL can be accessed via: https://graph.facebook.com/comments/?ids=http://developers.facebook.com/docs/reference/plugins/comments.

    Sample code for pulling comments can be found on this blog post.

    How can I get an SEO boost from the comments left on my site?

    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.

    How do I enable users to comment using other login providers?

    On the settings section of the plugin, you can choose to enable third party login on your comments boxes. Currently this will enable users to comment using a Yahoo!, AOL or Hotmail account.

    How does the blacklisting words work?

    You can enter blacklisted terms from the settings section of the comments box. The content of new comments is checked against the blacklist of terms to see if this comment should have limited visibility. The comment is checked via substring matching. This means if you blacklist the word 'at', if the comment contains the sequence 'a' 't' anywhere it will be marked with limited visibility; e.g. if the comment contained the words 'bat', 'hat', 'attend', etc it would be caught.

    I have the first version of the Facebook Comments box, how do I upgrade?

    If you are using the original version of the Facebook Comments box, just add 'migrated=1' to the <fb:comments> tag, and the comments box will automatically switch to the new version. In this case, you should not specify the href parameter, and you must keep the XID parameter the same. Once you migrate, you can access the comments as described above. Note that the moderation tools only work with the newer version of the comments plugin (with href specified instead of migrated=1).

    Updated on Thursday
    Facebook © 2013 · English (US)
    AboutAdvertisingCareersPlatform PoliciesPrivacy Policy