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. 2020 (14)
  2. 2019 (17)
  3. 2018 (2)
  4. 2017 (11)
  5. 2016 (3)
  6. 2015 (6)
  7. 2014 (3)
  8. 2013 (11)
  9. 2012 (25)