Extending FBML with Custom Tags
by Yariv Sadan - January 13, 2009 at 10:24am

When we released Facebook Platform in 2007 to our developer community, our goal was to enable you to build great social applications that are integrated with Facebook. FBML was one Platform component that provided a simple and powerful way to add social context to your Facebook applications. FBML also lowered the amount of effort involved in building applications by providing useful tags and user interface components that addressed the needs of many developers.

Initially, FBML included only tags that Facebook created. Today, we're excited to announce a new feature called custom tags. With custom tags, any developer can create new FBML tags. Developers can use these tags in their own applications, or they can share their custom tags with the entire Facebook developer community as pre-built FBML components.

So if you're an application developer and want to make your application even more content rich -- say by including music or news -- consider using an available custom tag set. For example, if you're building a wedding site and want to include a playlist of top wedding songs, you can use the iLike custom tag to embed a playlist of top wedding songs. See below for more information about iLike's custom tags and other examples.

If you've built an application with a lot of rich content, and you want to extend its reach and share that content with other Platform applications, create some custom tags and share this content with the community. Custom tags are easy to use and are a great way for you to extend your application's distribution. Say you have a video sharing application. You could create a video tag that renders a video player for a specific video, or a top-videos tag that renders a list of today's most popular videos. Other applications could easily embed this content and thereby expose it to users in new ways.

Another powerful benefit of custom tags is that you can use them to improve your application's performance. Much like how one FBML tag is a shorthand way to include a lot of markup (think of fb:comments, for example), one custom tag can replace a lot of FBML and HTML content inline. Using custom tags in this way lowers the communication overhead between Facebook and your application's servers. One custom tag can render a larger amount of content. Instead of sending the full FBML fragment with every request, you can replace it with a custom tag that Facebook will expand when Facebook parses the page.

We created a custom tags directory on the Developer wiki where you can find documentation on public (shared) tags created by other developers. If you've created new public tags, let the community know by adding their documentation to this wiki article.

Here are some great examples that are already live. You can quickly and easily embed them in your application:

You can read more about custom tags on the Developer wiki.

At this time, you can't render custom tags with fb:serverfbml, for use with iframe applications or Facebook Connect sites. We'll support custom tags in XFBML soon.

As always, please send us your comments and feedback about custom tags in the FBML section of the Developer Forum.