amp-twitter

Edit on Github
Open in Playground

Introduction

Use amp-twitter to 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. 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="375"
  height="472"
  layout="responsive"
  data-tweetid="638793490521001985">
</amp-twitter>

Hidden cards

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

Example

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

Twitter moment embed

Use data-momentid to include a twitter moment.

Example

<amp-twitter width="390"
  height="330"
  layout="responsive"
  data-momentid="1018806709412876288">
</amp-twitter>