Tag Archives: Twitter

adding twitter to your site

You can embed code directly from tweets in the content of your website using the more … functionality of twitter.

Twitter embedded tweets:

<blockquote class="twitter-tweet" lang="en"><p>Good times on Richmond river <a href="http://t.co/QaHosKx5oW">pic.twitter.com/QaHosKx5oW</a></p>&mdash; Martin Green (@m_r_green) <a href="https://twitter.com/m_r_green/status/557158863091564544">January 19, 2015</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

 

However, if you are going to use multiple twitter widgets on your site, then you should add the javascript to your template. This script will asynchronously inject widget.js into your page.

Details on the twitter developers page

Code to add to template:

<script>window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);
 
  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };
 
  return t;
}(document, "script", "twitter-wjs"));</script>