amp-instagram
Description
Displays an Instagram embed.
Required Scripts
<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-1.0.js"></script>
<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-1.0.js"></script> <link rel="stylesheet" href="https://cdn.ampproject.org/v0/amp-instagram-1.0.css">
Supported Layouts
Behavior
The width
and height
attributes are special for the Instagram embed.
These should be the actual width and height of the Instagram image.
The system automatically adds space for the "chrome" that Instagram adds around the image.
Many Instagrams are square. When you set layout="responsive"
any value where width
and height
are the same will work.
Example:
<amp-instagram data-shortcode="fBwFP" data-captioned width="400" height="400" layout="responsive" > </amp-instagram>
If the Instagram is not square you will need to enter the actual dimensions of the image.
When using non-responsive layout you will need to account for the extra space added for the "instagram chrome" around the image. This is currently 48px above and below the image and 8px on the sides.
Standalone use outside valid AMP documents
Bento allows you to use AMP components in non-AMP pages without needing to commit to fully valid AMP. You can take these components and place them in implementations with frameworks and CMSs that don't support AMP. Read more in our guide Use AMP components in non-AMP pages.
To find the standalone version of amp-instagram
, see bento-instagram
.
Attributes
data-shortcode | The instagram data-shortcode is found in every instagram photo URL.
For example, in https://instagram.com/p/fBwFP, fBwFP is the data-shortcode. |
data-captioned | Include the Instagram caption. amp-instagram will attempt to resize to the correct height including the caption. |
common attributes | This element includes common attributes extended to AMP components. |
您已多次阅读本文档,但它仍未能涵盖您的所有问题?也许其他人也这么觉得:在 Stack Overflow 上与他们联系。
前往 Stack Overflow 发现错误或缺少功能?AMP 项目强烈鼓励您参与并做出贡献!我们希望您能成为我们开放源代码社区的持续参与者,但我们也欢迎您对所热衷问题做出一次性贡献。
前往 GitHub