Description | Displays a Facebook Post or Video. |
Availability | Stable. |
Required Script | <script async custom-element="amp-facebook" src="https://cdn.ampproject.org/v0/amp-facebook-0.1.js"></script> |
Examples | amp-facebook.html facebook.amp.html |
Example - Embedding a post:
<amp-facebook width=486 height=657
layout="responsive"
data-href="https://www.facebook.com/zuck/posts/10102593740125791">
</amp-facebook>
Example - Embedding a video:
<amp-facebook width=552 height=574
layout="responsive"
data-embed-as="video"
data-href="https://www.facebook.com/zuck/videos/10102509264909801/">
</amp-facebook>
data-href
The URL of the facebook post/video. For example: https://www.facebook.com/zuck/posts/10102593740125791.
data-embed-as
Optional
Either post
or video
(default: post
).
Both posts and videos can be embedded as a post. Setting data-embed-as="video"
for Facebook videos only embed the player of the video ignoring the accompanying post card with it. This is recommended if you'd like a better aspect ratio management for the video to be responsive.
Checkout the documentation for differences between post embeds and video embeds.
The following lists validation errors specific to the amp-facebook
tag
(see also amp-facebook
in the AMP validator specification):
Validation Error | Description |
---|---|
The 'example1' tag is missing or incorrect, but required by 'example2'. | Error thrown when required amp-facebook extension .js script tag is missing or incorrect. |
The mandatory attribute 'example1' is missing in tag 'example2'. | Error thrown when data-href attribute is missing. |
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 . |