AMP

amp-instagram

 
You can now use this component outside valid AMP documents using the Bento version of this component. Learn more in the Bento guide.

Description

Displays an Instagram embed.

 

Required Scripts

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

Behavior

The width and height attributes are special for the Instagram embed. These should be the actual width and height of the Instagram image. The system automatically adds space for the "chrome" that Instagram adds around the image.

Many Instagrams are square. When you set layout="responsive" any value where width and height are the same will work.

Example:

<amp-instagram
  data-shortcode="fBwFP"
  data-captioned
  width="400"
  height="400"
  layout="responsive"
>
</amp-instagram>

If the Instagram is not square you will need to enter the actual dimensions of the image.

When using non-responsive layout you will need to account for the extra space added for the "instagram chrome" around the image. This is currently 48px above and below the image and 8px on the sides.

Attributes

data-shortcode The instagram data-shortcode is found in every instagram photo URL.
For example, in https://instagram.com/p/fBwFP, fBwFP is the data-shortcode.
data-captioned Include the Instagram caption. amp-instagram will attempt to resize to the correct height including the caption.
common attributes This element includes common attributes extended to AMP components.

Validation

See amp-instagram rules in the AMP validator specification.

Precisa de mais ajuda?

Você já leu este documento várias vezes, mas ainda ficou com dúvidas sem respostas? Talvez outras pessoas pensem da mesma forma. Procure entrar em contato com elas no Stack Overflow.

Ir para o Stack Overflow
Encontrou um bug ou sente falta de um recurso?

O projeto AMP incentiva fortemente sua participação e contribuições! Esperamos que você se torne um participante assíduo de nossa comunidade de código aberto, mas também agradecemos contribuições pontuais para problemas que você tenha particular interesse.

Ir para o GitHub