Do you build things with AMP? Fill out the new AMP Developer Survey!
AMP

amp-reddit

Description

Displays a Reddit comment or post embed.

Required Scripts

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

示例

Examples

Use the amp-reddit component to embed a Reddit post or comment.

Example: Embedding a Reddit 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>

Example: Embedding a Reddit comment

<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-uuid="b1246282-bd7b-4778-8c5b-5b08ac0e175e"
  data-embedcreated="2016-09-26T21:26:17.823Z"
  data-embedparent="true"
  data-embedlive="true"
>
</amp-reddit>

Attributes

data-embedtype (required) The type of embed, either post or comment.
data-src (required) The permamlink uri for the post or comment.
data-uuid The provided UUID for the comment embed. Supported when data-embedtype is comment.
data-embedcreated The datetime string for the comment embed. Supported when data-embedtype is comment.
data-embedparent The datetime string for the comment embed. Supported when data-embedtype is comment.
data-embedlive Indicates whether the embedded comment should update if the original comment is updated. Supported when data-embedtype is comment.
common attributes This element includes common attributes extended to AMP components.

Validation

See amp-reddit rules in the AMP validator specification.

需要更多帮助?

您多次阅读的资料未能涵盖您的所有问题?也许其他人也这么觉得 在 Stack Overflow 上与他们取得联系。

前往 Stack Overflow
找到一个 bug 或者缺失某项功能?

AMP 项目强烈鼓励您参与其中并作出贡献!我们希望您能成为我们开源社区的持续参与者,但我们也欢迎您对热衷问题做出单次贡献。

前往 GitHub