Published

Updated

Embedding a Twitter Feed in Drupal without any additional modules

Many people are now using twitter to keep friends, clients and others updated on what they’re doing – as such we often get asked about embedding a twitter feed in drupal websites when clients come to see us.

There are several modules available within Drupal such as the obviously named twitter, but sometimes this can be a bit of an overhead if you’re not wanting to do any more than display tweets on a webpage. All is not lost though, as twitter information can be easily embedded in a Drupal site without requiring any additional modules.

Twitter provide a ‘widget’ at http://twitter.com/goodies/widget_profile that can be embedded in any webpage – it consists of some html that calls javascript and css on the twitter site and is can be customised with different colours, layouts etc. After choosing the various options, click the ‘finish and choose code’ button and HTML looking something like the below is produced:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<script src="http://widgets.twimg.com/j/1/widget.js"></script>

<script>// <![CDATA[

newTWTR.Widget({

profile:true,

id:'twtr-profile-widget',

loop:true,

width:250,

height:300,

theme:{

shell:{

background:'#3082af',

color:'#ffffff'

},

tweets:{

background:'#ffffff',

color:'#444444',

links:'#1985b5'

}

}

}).render().setProfile('simonhanmer').start();

// ]]></script>

This code can be embedded in a standard Drupal block (although you’ll probably want to replace the twitter name in the setProfile call) – simply login as an administrator, or a user with permission to post full html code and