amp-twitter

Edit on Github
Open in Playground

Introduction

Embed tweets into your AMP HTML files.

Setup

Don't forget to import the twitter component

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

Basic Usage

Tweets are embedded via id.

Example

<amp-twitter width="375"
  height="472"
  layout="responsive"
  data-tweetid="638793490521001985">
</amp-twitter>

Options for the Tweet appearance can be set using data- attributes. E.g. data-cards="hidden" deactivates Twitter cards.

Example

<amp-twitter width="390"
  height="330"
  layout="responsive"
  data-tweetid="585110598171631616"
  data-cards="hidden">
</amp-twitter>

Twitter does not currently provide an API that yields fixed aspect ratio Tweet embeds. You may need to manually tweak the provided width and height.

Example

<amp-twitter width="390"
  height="330"
  data-tweetid="585110598171631616"
  data-cards="hidden">
</amp-twitter>