amp-reddit
简介
amp-reddit
组件允许将 reddit 帖子和评论嵌入到 AMP 文件中。
设置
导入 amp-reddit
组件
<script async custom-element="amp-reddit" src="https://cdn.ampproject.org/v0/amp-reddit-0.1.js"></script>
帖子嵌入
嵌入单个帖子。
<amp-reddit layout="responsive" width="300" height="400" data-embedtype="post" data-src="https://www.reddit.com/r/me_irl/comments/52rmir/me_irl/?ref=share&ref_source=embed">
</amp-reddit>
评论嵌入
嵌入单个评论。
<amp-reddit layout="responsive" width="400" height="400" data-embedtype="comment" data-src="https://www.reddit.com/r/me_irl/comments/52rmir/me_irl/d7n3soo/">
</amp-reddit>
父评论
通过指定 data-embedparent="true"
嵌入父评论。
<amp-reddit layout="responsive" width="400" height="400" data-embedtype="comment" data-src="https://www.reddit.com/r/me_irl/comments/52rmir/me_irl/d7n3soo/" data-embedparent="true">
</amp-reddit>
自动更新评论
当原始评论更新时,通过指定 data-embedlive="true"
来更新评论
<amp-reddit layout="responsive" width="400" height="400" data-embedtype="comment" data-src="https://www.reddit.com/r/sports/comments/54loj1/50_cents_awful_1st_pitch_given_a_historical/d8306kw" data-embedlive="true">
</amp-reddit>
需要进一步解释?
如果此页面上的解释不能涵盖您所有的问题,请随时与其他 AMP 用户联系,讨论您的确切用例。
转到 Stack Overflow 未解释的功能?AMP 项目强烈鼓励您的参与和贡献!我们希望您能成为我们开源社区的持续参与者,但我们也欢迎您对您特别感兴趣的问题进行一次性贡献。
在 GitHub 上编辑示例-
作者: @nainar