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>
Supported Layouts
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>
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>
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 |
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.
Bạn đã đọc tài liệu này hàng chục lần, nhưng nó không thật sự trả lời mọi thắc mắc của bạn? Có lẽ những người khác cũng cảm thấy như vậy: hãy liên hệ với họ trên Stack Overflow.
Truy cập Stack Overflow Bạn tìm thấy một lỗi hoặc cần bổ sung một tính năng?Dự án AMP đặc biệt khuyến khích sự tham gia và đóng góp của bạn! Chúng tôi hi vọng bạn sẽ trở thành một người tham gia tích cực trong cộng đồng mã nguồn mở của chúng tôi, nhưng chúng tôi cũng chào mừng các đóng góp đơn lẻ về vấn đề mà bạn đặc biệt quan tâm.
Truy cập GitHub