amp-instagram
简介
使用 amp-instagram
组件将 Instagram 视频和照片嵌入到您的 AMP HTML 文件中。
设置
在标头中导入 amp-instagram 组件
<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script>
基本用法
Instagram 照片通过 instagram data-shortcode 嵌入,该代码在每个 Instagram 照片 URL 中都可以找到。许多 Instagram 照片都是正方形的。当您设置 layout="responsive"
时,任何 width
和 height
值相同的数值都适用。
<amp-instagram data-shortcode="1totVhIFXl" width="1" height="1" layout="responsive">
</amp-instagram>
非方形图像
如果图像不是正方形,则 width
和 height
应为 Instagram 图像的实际宽度和高度。
<amp-instagram data-shortcode="_hIitKIFcg" width="600" height="450" layout="responsive">
</amp-instagram>
标题
您可以使用 data-captioned
属性包含标题
<amp-instagram data-shortcode="BMQ8i4lBTlb" data-captioned width="1" height="1" layout="responsive">
</amp-instagram>
需要进一步解释?
如果此页面上的解释没有涵盖您所有的问题,请随时联系其他 AMP 用户讨论您的确切用例。
前往 Stack Overflow 未解释的功能?AMP 项目强烈鼓励您的参与和贡献!我们希望您能成为我们开源社区的长期参与者,但我们也欢迎您针对您特别感兴趣的问题进行一次性贡献。
在 GitHub 上编辑示例-
作者: @sebastianbenz