AMP
  • websites

amp-twitter

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.

<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.

<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.

<amp-twitter width="390" height="330" layout="responsive" data-momentid="1018806709412876288">
</amp-twitter>
Bạn cần được giải thích thêm?

Nếu bạn vẫn còn thắc mắc sau khi đọc hướng dẫn trên trang này, hãy liên hệ với những người dùng AMP khác để thảo luận về trường hợp sử dụng cụ thể của bạn.

Truy cập Stack Overflow
Một tính năng chưa được giải thích?

Dự án AMP đặc biệt khuyến khích sự tham gia và đóng góp của bạn! Chúng tôi hi vọng bạn sẽ trở thành một người tham gia tích cực trong cộng đồng mã nguồn mở của chúng tôi, nhưng chúng tôi cũng chào mừng các đóng góp đơn lẻ về vấn đề mà bạn đặc biệt quan tâm.

Chỉnh sửa mẫu trên GitHub