在 AMP 中使用 spot.im



我已经实现了静态网页,我想将它们移动到 AMP。我正在使用SPOT。IM (http://www.spot.im/( .有没有办法在 AMP 网页中使用 spot.im?或者您是否知道 AMP 网页中用于相同目的的任何不同服务?

是的,这是一种方式:https://github.com/SpotIM/spotim-integration-docs/blob/master/google-amp/README.md

您必须使用 amp-iframe 组件:https://www.ampproject.org/docs/reference/components/amp-iframe

将此脚本链接添加到页面头部:

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

并在网页正文中使用 amp-iframe:

<amp-iframe width="375" height="815" resizable
sandbox="allow-scripts allow-same-origin allow-popups allow-top-navigation"
layout="responsive" frameborder="0"
src="https://amp.spot.im/production.html?spot_im_highlight_immediate=true&spotId=SPOT_ID&postId=POST_ID">
<amp-img placeholder height="815" layout="fill" src="//amp.spot.im/loader.png"></amp-img>
<div overflow class="spot-im-amp-overflow" tabindex="0" role="button" aria-label="Read more">Load more...</div>

使用您的SPOT_IDPOST_ID

最新更新