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 撰写