Embedded User Timeline¶
A user timeline displays the latest Tweets ordered from newest to oldest from a specific public Twitter account. The timeline includes a Follow button in the header to encourage new followers and a mention web intent footer to encourage new conversations specific to your Twitter account.
Generate markup for an embedded user timeline on publish.twitter.com.
HTML markup¶
A responsive user timeline can be added to a webpage through a common HTML template.
A template example:
<a class="twitter-timeline"
href="https://twitter.com/{screen_name}">
Tweets by @{screen_name}
</a>
<a class="twitter-timeline"
href="https://twitter.com/twitterdev">
Tweets by @TwitterDev
</a>
JavaScript factory function¶
Twitter’s widget JavaScript library supports dynamic insertion of an embedded user timeline using the twttr.widgets.createTimeline function. Pass a data source definition, target container element, and optional options object to insert an embedded timeline into your page.
HTML data-* parameters are camelCased when passed as an options object property.
twttr.widgets.createTimeline(
{
sourceType: "profile",
screenName: "TwitterDev"
},
document.getElementById("container")
);