Skip to content

Latest commit

 

History

History
118 lines (100 loc) · 5.86 KB

amp-instagram.md

File metadata and controls

118 lines (100 loc) · 5.86 KB

amp-instagram

Description Displays an instagram embed.
Availability Stable
Required Script <script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script>
Examples amp-instagram.html
instagram.amp.html

The following lists validation errors specific to the amp-instagram tag (see also amp-instagram in the AMP validator specification):

Validation Error Description
The 'example1' tag is missing or incorrect, but required by 'example2'. Error thrown when required amp-instagram extension .js script tag is missing or incorrect.
The tag 'example1' is missing a mandatory attribute - pick one of example2. Error thrown when neither data-shortcode or src is included. One of these attributes is mandatory.
Missing URL for attribute 'example1' in tag 'example2'. Error thrown when data-shortcode or src is missing it's URL.
Malformed URL 'example3' for attribute 'example1' in tag 'example2'. Error thrown when data-shortcode or src URL is invalid.
Invalid URL protocol 'example3:' for attribute 'example1' in tag 'example2'. Error thrown data-shortcode or src URL is http; https protocol required.
The implied layout 'example1' is not supported by tag 'example2'. Error thrown when implied layout is set to CONTAINER; this layout type isn't supported.
The specified layout 'example1' is not supported by tag 'example2'. Error thrown when specified layout is set to CONTAINER; this layout type isn't supported.
The property 'example1' in attribute 'example2' in tag 'example3' is set to 'example4', which is invalid. Error thrown when invalid value is given for attributes height or width. For example, height=auto triggers this error for all supported layout types, with the exception of NODISPLAY.
The attribute 'example1' in tag 'example2' is deprecated - use 'example3' instead. The attribute shortcode is deprecated - use data-shortcode instead.

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"
    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 found in every instagram photo URL.

E.g. in https://instagram.com/p/fBwFP fBwFP is the data-shortcode.