Keep your content fresh by leveraging the Twitter API
July 20, 2010
We understand the benefit of having fresh content on a website. By keeping the messages on your site current and relevant you can drive up repeat traffic and keep the search engine bots busy indexing your site. Whether you do it as a service for your visitors or to stay up in the rankings its a smart thing to do to stay noticed.
Many of our clients cringe at the thought of writing a blog entry or industry-relevant article on a weekly or even monthly basis. We get that. We have the same problem. Fact of the matter is, that unless you’re a writer by trade, we’re just too busy doing what it is we do to bother writing about it. And that’s where Twitter comes into the picture…
Twitter is great because it’s effortless. Pretty much anyone has at least one free moment per week to tap out 140 characters. Even better still, most news and social channels on the internet have integrated a “share on Twitter” feature that allows you to Tweet an update and link to an article of interest without even writing anything yourself!
Developers jumped on the idea of displaying Tweets on other web pages early on. You can even download a variety of Javascript widgets for displaying Tweets directly from Twitter! While these widgets are pretty great they are only really appropriate for clients who can generate a steady stream of Twitter traffic.
Where the widgets end up failing is that they are entirely Javascript based meaning that the content is all client side. This poses two problems:
- search engine bots are completely blind to any content generated by client-side scripts
- the constant bombardment of the Twitter API from these widgets is partially responsible for the frequent Twitter outages seen of late
So what’s the solution?
Rather than running real-time feeds on every one of your visitor’s browsers we can access the Twitter API using server-side scripts and render the Tweets directly on the page. With this method the Tweet is part of the page so it’s easy for search engine bots to parse and index it’s content.
Furthermore, smart developers should implement a caching mechanism that saves a local copy of the feed on the server and only checks for new Tweets periodically. This sort of caching client-server communication model is widespread across most web applications but with the popularity and ease of implementing the Javascript widgets has been overlooked when it comes to Twitter.
I’ll be posting a PHP example here shortly. Stay tuned!
Comment
By submitting a comment here you grant ORGANISM a perpetual license to reproduce your words and name/web site in attribution. Inappropriate or irrelevant comments will be removed at an admin's discretion.