AMP Roadshow is coming to Atlanta & Berlin!
AMP
  • websites

amp-facebook

Introduction

The amp-facebook component allows embedding both Facebook posts and videos into AMP files.

Setup

Import the amp-facebook component

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

Basic usage

The amp-facebook component only requires the URL of the facebook post...

<amp-facebook width="552"
  height="303"
  layout="responsive"
  data-href="https://www.facebook.com/zuck/posts/10102593740125791">
</amp-facebook>

Video

Here is a sample for a Facebook video embed.

<amp-facebook width="552"
  height="310"
  layout="responsive"
  data-href="https://www.facebook.com/zuck/videos/10102509264909801/">
</amp-facebook>

Video with card

Setting data-embed-as="video" will embed the video with the accompanying card.

<amp-facebook width="552"
  height="310"
  layout="responsive"
  data-embed-as="video"
  data-href="https://www.facebook.com/zuck/videos/10102509264909801/">
</amp-facebook>

Video without card

Setting data-embed-as="post" will embed the video without the accompanying card.

<amp-facebook width="552"
  height="310"
  layout="responsive"
  data-embed-as="post"
  data-href="https://www.facebook.com/zuck/videos/10102509264909801/">
</amp-facebook>
Need further explanation?

If the explanations on this page don't cover all of your questions feel free to reach out to other AMP users to discuss your exact use case.

Go to Stack Overflow
An unexplained feature?

The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.

Edit sample on GitHub