AMP

重要提示:此文档不适用于您当前选择的格式故事

amp-reddit

描述

显示 Reddit 评论或帖子嵌入。

 

必需脚本

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

示例

使用 amp-reddit 组件嵌入 Reddit 帖子或评论。

示例:嵌入 Reddit 帖子

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

示例:嵌入 Reddit 评论

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

属性

data-embedtype(必需) 嵌入类型,postcomment
data-src(必需) 帖子或评论的永久链接 URI。
data-uuid 评论嵌入提供的 UUID。 当 data-embedtypecomment 时支持。
data-embedcreated 评论嵌入的日期时间字符串。 当 data-embedtypecomment 时支持。
data-embedparent 评论嵌入的日期时间字符串。 当 data-embedtypecomment 时支持。
data-embedlive 指示如果原始评论更新,嵌入的评论是否应该更新。 当 data-embedtypecomment 时支持。
title 为组件定义一个 title 属性。 默认值为 Reddit
通用属性 此元素包含扩展到 AMP 组件的通用属性

验证

请参阅 AMP 验证器规范中的 amp-reddit 规则

需要更多帮助?

您已经阅读此文档十几次了,但它并没有真正涵盖您的所有问题? 也许其他人也有同样的感觉:在 Stack Overflow 上联系他们。

转到 Stack Overflow
发现错误或缺少功能?

AMP 项目强烈鼓励您的参与和贡献! 我们希望您成为我们开源社区的长期参与者,但也欢迎您为自己特别热衷的问题做出一次性贡献。

转到 GitHub