The Embed Button allows you to allow users to embed your site's content with a
single click.

The Embed Button allows you to allow users to embed your site's content with a
single click. Get more impressions from all over the web. To create a Button
for your site visit the Button Generator.

🚧

platform.js is required.

In order to use the button you first need to install platform.js. Please see the install instructions platform.js

By default platform.js will create a button for an A tag with the class embedly-button. For example, this will create a button:

<a class="embedly-button" href="http://embed.ly/code">Embed</a>

If you would like to specify a URL to embed, you can use the data-url property like so:

<a class="embedly-button" data-url="http://apple.com"
		href="http://embed.ly/code">Embed</a>

Customize

There are a number of data-* attributes that you can use to customize the button. They are as follows:

AttributeValueDescription
data-urlURL i.e http://embed.lySpecifies the URL to embed, by default it uses the URL of the page it is placed on
data-theme"round", "flat", "light-round", "light-flat"Sets the look of the button. The default it "round"
data-lang"en", "de", "tr", "es"The language of the Embed button, by default we use the browser's locale.
data-target"window" (defaults to modal)Opens the embed dialog in a new window instead of a modal.

JavaScript

With Platform.js allows you to control buttons programatically. For instance to use a different class name for the button you can use the the following code:

embedly('button', 'embed-this');

If you would like to create a button from a single element you can do the following:

var a = document.getElementById('#myCard');
embedly('button', a, {
  target: 'window'
});

If platform.js has not loaded yet, it will queue actions till we are ready to act on them.

Modal

Modal

If you would like to manually trigger the Embed Modal you can do this via the
following javascript:

embedly('modal', 'http://embed.ly');

This will bring up a modal in which the user can choose to copy the Embed code.
If you wish to open the dialog in a new window instead, you may use the
following code:

embedly('modal', {
  url: 'http://embed.ly',
  target: 'window'
});

For more information on the cards that button and modals generate, check out
the cards.