Skip to content

Latest commit

 

History

History
118 lines (100 loc) · 5.08 KB

amp-instagram.md

File metadata and controls

118 lines (100 loc) · 5.08 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 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
TAG_REQUIRED_BY_MISSING Error thrown when required amp-instagram extension .js script tag is missing or incorrect.
MANDATORY_ONEOF_ATTR_MISSING Error thrown when neither data-shortcode or src is included. One of these attributes is mandatory.
MISSING_URL Error thrown when data-shortcode or src is missing it's URL.
INVALID_URL Error thrown when data-shortcode or src URL is invalid.
INVALID_URL_PROTOCOL Error thrown data-shortcode or src URL is http; https protocol required.
IMPLIED_LAYOUT_INVALID Error thrown when implied layout is set to CONTAINER; this layout type isn't supported.
SPECIFIED_LAYOUT_INVALID Error thrown when specified layout is set to CONTAINER; this layout type isn't supported.
INVALID_PROPERTY_VALUE_IN_ATTR_VALUE 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.
DEPRECATED_ATTR 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.