Fixing Twitter sidebar for Octopress 2.x

I noticed recently that the Octopress Twitter plugin for my sidebar was broken. The reason is that Twitter no longer supports the APIs that the plugin accesses. Instead now they have a widget page to generate html code that will embed a list of your tweets on your page.

I created a widget for myself and customised it by adding the nofooter transparent noheader attributes to data-chrome. These remove various headings and background colouring so that it blends in with the site a bit more.

To add this to an Octopress site, you replace the code in source/_includes/asides/twitter.html with this new code. I also added a follow button which displays a Twitter formatted follow button and a count of your subscribers.

The full code is as follows

<!-- source/_includes/asides/twitter.html -->
{% if site.twitter_user %}
<section>
  <h1>Latest Tweets</h1>
  <a class="twitter-timeline" data-chrome="nofooter transparent noheader" data-tweet-limit="5" href="https://twitter.com/gercondon">Tweets by gercondon</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
  <a class="twitter-follow-button" href="https://twitter.com/gercondon">Follow @gercondon</a>
</section> 
{% endif %}

posted on November 9, 2016developmentoctopress

Tags

By year

  1. 2019 (16)
  2. 2018 (2)
  3. 2017 (11)
  4. 2016 (3)
  5. 2015 (6)
  6. 2014 (3)
  7. 2013 (11)
  8. 2012 (25)