AMP
  • websites

amp-reddit

Introduction

The amp-reddit component allows embedding both reddit posts and comments into AMP files.

Setup

Import the amp-reddit component

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

Post embed

Embeds a singe post.

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

Comment embed

Embeds a single comment.

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

Parent comment

Embeds the parent comment by specifying 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>

Auto update comments

Updates comments when the original comment is updated by specifying 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 上的示例