AMP

Important: this documentation is not applicable to your currently selected format email!

amp-iframely

Description

Displays Iframely.com-powered rich media embeds

 

Required Scripts

<script async custom-element="amp-iframely" src="https://cdn.ampproject.org/v0/amp-iframely-0.1.js"></script>

Embeds and displays Iframely.com-powered rich media embeds from over 1900 third-party publishers. Shows URL previews as summary card for any other URL.

<amp-iframely> embeds content through the third-party vendor Iframely.com. It should not be confused with <amp-iframe>, which embeds any URL directly.

Required Script <script async custom-element="amp-iframely" src="https://cdn.ampproject.org/v0/amp-iframely-0.1.js"></script>
Supported Layouts responsive, fixed-height

Overview

The amp-iframely connects you to Iframely cloud service. It provides responsive embeds codes and rich media support for over 1900 third party publishers. Plus summary cards as URL previews for the rest of the Internet.

You'd likely get amp-iframely code generated by from Iframely APIs. But you may also skip making API calls and use Iframely in AMP directly (we recommend responsive layout, with resizable flag in that case).

Please get your API key at iframely.com.

Example: Embed third party via content ID

<amp-iframely width="400" height="225"
    data-id="I8NNa1s"
    layout="responsive"
    data-img>
</amp-iframely>
このスニペットを Playground で開く

Example: Summary card for any URL via API key

<amp-iframely height="140"
    data-url="https://iframely.com"
    data-key="30ef29b325c50219755786a371c281ad"
    layout="fixed-height"
    resizable>
</amp-iframely>
このスニペットを Playground で開く

Feel free to try any URL with the API key from the above example. However, it is restricted for use on amp.dev only.

Attributes

Indentifying

There are two ways to identify rich media. Either with the help of Iframely-issued ID, or with a pair of media URL and your API key (MD5-hashed for security reasons):

data-id Iframely content ID, if available
data-url

Alternatively, if no content ID, identify rich media by its canonical URL.

data-key

If data-url is used, also add the MD5 hash of your Iframely API key as data-key attribute. Hash your key, the unencrypted value won't work here.

Placing

amp-iframely supports responsive and fixed-height layouts:

width and height Use both attributes for responsive media to define its aspect-ratio. Use only height for a fixed-height layout. If you don't have media sizes - use what works best as a placeholder, and add resizable as below.
resizable A flag to add event listener and adjust component's height automatically to fit and match the rich media content. This works with both responsive and fixed-height layouts.
data-img Empty attribute, indicating that rich media's thumbnail image should be used as a placeholder while the component and its content loads. No value please - Iframely will find the reqiured image address on its own.

Any other of Iframely's query-string API parameters can be passed as data- prefixed attribute. For example, align="left" API parameter becomes data-align="left" attribute. Custom provider-specific options can also be passed as data- attribute.

Validation

As a mininum, either data-id attribute or a pair of data-url and data-key are required to identify the third party rich media content and authenticate with Iframely.

さらに支援が必要ですか?

このドキュメントを何度読み返しても、ご質問のすべてを完全に解消することができませんか?他にも同じ事を感じた人がいるかもしれません。Stack Overflow で問い合わせてみましょう。

Stack Overflow にアクセスする
バグや不足している機能がありますか?

AMP プロジェクトでは皆さんの参加と貢献を強くお勧めしています!当社はオープンソースコミュニティに継続的にご参加いただくことを希望しますが、特に熱心に取り組んでいる問題があれば1回限りの貢献でも歓迎します。

GitHub にアクセスする