12/19/2016

Cara memasukkan tombol pinterest di AMP Html


amp-pinterest


Komponen amp-pinterest memungkinkan menyematkan tombol Pin It di sebelah gambar atau Anda dapat menyematkan (embed) gambar dari sumber resmi Pinterest dalam widget.

1 Kode pembuka

<!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <script async src="https://cdn.ampproject.org/v0.js"></script>

2 Disposisi

Masukkan skrip berikut tepat setelah <head>

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

3 Pin It Button

Atur data-do ke buttonPin aktifkan saat mengatur konten di situs Anda. Atribut berikut diperlukan:

data-url    URL yang akan dibagikan.
data-media     URL gambar absolut yang tidak dapat bergerak.
data-description     Deskripsi default yang muncul pada pin untuk membuat formulir.

Codenya


<figure>
    <amp-img src="/img/amp.jpg"
        width="300"
        height="169"
        alt="an image"></amp-img>
    <amp-pinterest height=28
        width=56
        data-do="buttonPin"
        data-url="http://amphtmlejemplos.blogspot.com/"
        data-media="https://ampbyexample.com/img/amp.png"
        data-description="amp-pinterest in action">
    </amp-pinterest>
  </figure>

Demostración



4 Widget untuk menyematkan pin

Untuk menyisipkan (Sematkan) Widget Pin It dan gambar dari Pinterest, Anda harus meningkatkan data-do ke embedPing. Atribut data-url harus berisi URL lengkap sumber daya Pinterest.

Codenya


<amp-pinterest width=320
      height=213
      data-do="embedPin"
      data-url="https://www.pinterest.com/pin/859554278859340013/">
  </amp-pinterest>

Demostración



Kemudian FULL struktur kode lengkap

<!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <script async src="https://cdn.ampproject.org/v0.js"></script>

<script async custom-element="amp-pinterest" src="https://cdn.ampproject.org/v0/amp-pinterest-0.1.js"></script>
<link rel="canonical" href="http://amphtmlejemplos.blogspot.com/2016/12/como-insertar-el-boton-de-pinterest-en-amp-html.html">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
  <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
</head>
<body>
<figure>
    <amp-img src="/img/amp.jpg"
        width="300"
        height="169"
        alt="an image"></amp-img>
    <amp-pinterest height=28
        width=56
        data-do="buttonPin"
        data-url="http://amphtmlejemplos.blogspot.com/"
        data-media="https://ampbyexample.com/img/amp.png"
        data-description="amp-pinterest in action">
    </amp-pinterest>
  </figure>
 <amp-pinterest width=320
      height=213
      data-do="embedPin"
      data-url="https://www.pinterest.com/pin/859554278859340013/">
  </amp-pinterest>
</body>
</html>



Share:

Related post

You Might Also Like:

Disqus comments:


Facebook comments: