Fb:comments (XFBML)

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

Displays a Comments Box on a Facebook Connect site or in an IFrame application. The Comments Box is the XFBML version of the fb:comments tag. It lets developers add a comment box to a website or in an iframe application easily.

The Comments Box has a default appearance with a rounded box around each post, or you can use the simple attribute to remove the box. If you want, you can choose to specify your own stylesheet (by including the css attribute and reference the URL to your stylesheet).

You can modify the Comments Box's colors and fonts, but you cannot delete, obscure or modify:

  • The Facebook favicon
  • The links to the logged in user and logout
  • The user's profile picture
  • The checkbox to let the user agree to publish the comment on their profile
  • The Post button

If you want to moderate comments before they get posted, set numposts to 0. This hides all comments. You can then use comments.get to retrieve all your comments and moderate or filter them as needed.

Attributes

RequiredNameTypeDescription
optional xid string The unique identifier for this set of comments. Comments can contain alphanumeric characters (Aa-Zz, 0-9), hyphens (-), percent (%), period (.), and underscores (_) (in effect, the result of any urlencode can be a valid XID). Facebook recommends you specify an xid; otherwise any extra GET params that are added after the URL, before the hash, will be made into the XID and the Comments Box will "swap" whenever parameters are appended/changed. (Default value is URL-encoded URL of the page without the hash.)
numposts int The maximum number of posts to display. You can set numposts to 0 to not display any comments. (Default value is 10.)
width string The width of the Comments Box in pixels. (Default value is 550px.)
css string The URL to your own stylesheet.
Note: To provide you with better performance, we cache your stylesheet. If you update your stylesheet, you should use a cachebreaker in the URL to the stylesheet, typically by appending a version number to the .CSS file extension, as in http://www.example.com/my.css?2.
title string This is the title of the Feed story that gets published when a comment is made. (Default value is the title of the Web page containing the Comments Box.)
url string The URL to the page where the comment was made. (Default value is window.document.location.href.)
simple bool When true, a rounded box does not appear around each post on your site. (Default value is false.)
reverse bool When true, reverses order of comments so the most recent one appears at the bottom of the list and the composer appears at the bottom of the page. (Default value is false.)
quiet bool When true, ensures that posts to this board don't send any notifications. By default, they are automatically sent to the last n commenters. (Default value is false.)

Examples

<fb:comments numposts="4" title="My Blog Comments" css="http://www.yourwebsite.com/css/comments.css?1234" simple="1"></fb:comments>

See Also

reference