Name

<fb:share-button/>

Synopsis

<fb:share-button class="...">...</fb:share-button>

Takes a given target URL—optionally with some meta information so that it knows what to render—and displays a dialog box with a preview box of the target URL, inviting the user to share that content with friends. The “Share” button will automatically try to render the URL for you, or else you can provide metadata explicitly in the share-button call or in the site itself that tells Facebook how to display the preview.

FBML-Specific Attributes

Required

class=[url|meta] default: none

The method to provide attributes to Facebook to aid in rendering the preview to be shared.

href=[string] default: none

Required only when class="url" is used. This is the URL to render a preview for. The URL should contain meta elements (listed next) to provide the most intelligent preview possible.

Optional

If meta is selected for the class attribute, you must provide optional link and meta tags within the <fb:share-button/> tags.

Meta and Link Tags

The following are the accepted meta and link tags for different types of content.

Basic meta tags

These tags can be used with any content type. Be sure to include the medium meta tag to specify the type of content. You can create a preview of any page, not just audio and video sources, using these tags:

  • <meta name="title" content="The title of the page"/>

  • <meta name="description" content="The description of the content on the page"/>

  • <meta name="medium" content="[audio|image|video|news|blog|mult]"/> ...

Get FBML Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.