Guest Post! Graham Waldon from Google

Tuesday, 19 December 2006

Graham Waldon has been working for several years behind the walls of the Googleplex on Blogger and he knows all the tricks. In this first-ever guest post on the Twitter Blog Graham has a tip for how bloggers with twitter badges can sail smoothly past those occasional times when Twitter is taking a little, *ahem* “cat-nap” (so to speak).

Twitter was down for a little while Sunday afternoon. (It happens to the best of us). Unfortunately, I’ve currently got my Twitter updates showing above my blog posts, and with Twitter temporarily unreachable, it stalled the loading of my entire page until it finally timed out. Bummer, that. Ideally, it would load my entire page first, and then work on contacting Twitter, so that folks could start reading my posts right away. Turns out that’s pretty easy to do. Here’s how.

Disclaimer: This only works with the Javascript version of the Twitter badge code, not the fancy flash version.

To put Twitter updates on your site, you get a chunk of code that looks more or less like the following. (Be sure to get the version of the code for your specific account, rather than copying this.)


The first piece of Javascript and the span tags are nothing we need to worry about. Those just determine where on your page you want the updates to appear. It’s the last line that’s at issue here, because that’s the part that actually tries to contact (as you can see from the URL it’s using).

So all you need to do here is leave the majority of the code right where you want the text to show up. Then move only the last line to the very end of your page. If you’re editing the HTML of your page directly, put it right before the


tags that finish off your page. If you’re in Blogger and using the new Layouts system, just make a new HTML/Javascript widget in your footer, and paste the code in there.

Optional: In between one of the sets of tags, add a note like “(no updates right now).” That note will only appear until the last line of Twitter code is executed, at which point it will be replaced with your actual updates. Or you can just leave it blank.

That’s it! Implement it yourself, if you like, and hopefully we’ll never need it.

Guest Posted by: Graham Waldon