¿Cómo insertar el boton de pinterest en Amp HTML?


amp-pinterest


El componente amp-pinterest permite la incrustación de un botón de Pin It a lado de las imágenes o a su ves se puede incrustar (Embed) una imagen desde la fuente oficial de Pinterest en un widget.

1 Código de apertura

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

2 Disposición

Inserte el siguiente script justos despues del <head>

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

3 Pin It Button

Ajuste data-do a buttonPin habilitar al fijar el contenido en su sitio. Se requieren los siguientes atributos:

data-url    La URL para ser compartida.
data-media     La URL de imagen absoluta que se inmoviliza.
data-description     La descripción predeterminada que aparece en el pasador de crear la forma.

Código


<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 para incrustar el pin

Para insertar (Embed) el Widget Pin It y la imagen desde Pinterest, tendrá que aumentar data-do a embedPing. El atributo data-url debe contener la dirección URL completa del recurso Pinterest.

Código


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

Demostración



A continuación la estructura completa del código

<!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/15903404914505189/">
  </amp-pinterest>
</body>
</html>


Share:

Related post

Comentarios

Disqus

Disqus comments:


Facebook

Facebook comments: