AMP
  • 网站

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&amp;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 上编辑示例