AMP
  • websites

amp-pinterest

Introduction

The amp-pinterest component allows embedding a save button or pin widget.

Setup

Import the amp-pinterest component in the header.

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

Save button

Set data-do to buttonPin to enable pinning content on your site. These attributes are required:

  • data-url: the URL to be shared.
  • data-media the absolute image URL to be pinned.
  • data-description: the default description that appears in the pin create form.
<amp-img src="/static/samples/img/amp.jpg"
  width="300"
  height="169"
  alt="an image"></amp-img>
<amp-pinterest height="18"
  width="56"
  data-do="buttonPin"
  data-url="https://amp.dev/documentation/examples/"
  data-media="https://amp.dev/documentation/examples/"
  data-description="amp-pinterest in action">
</amp-pinterest>

Embed pin widget

To embed the pin widget, set data-do to embedPin. The data-url attribute must contain the fully-qualified URL of the Pinterest resource.

<amp-pinterest width="236"
  height="326"
  data-do="embedPin"
  data-url="https://www.pinterest.com/pin/228065168607834583/">
</amp-pinterest>
需要进一步说明?

如果此页面的说明未能涵盖您的所有问题,欢迎与其他 AMP 用户取得联系,讨论您的具体用例。

前往 Stack Overflow
一项无法解释的功能?

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

在 GitHub 上编辑实例