Hosting
Green web hosting packagesTutorials
Beginners guides to SEO & hostingWIGHT HAT BLOG
Using Twitter to update your website
Adam Provis, May 8, 2011
A quick and easy way to keep your website updated with your latest news, special offers or events is to use a Twitter display on your pages. Even if you have a CMS on your website it can be more hassle than it’s worth to constantly update your site with small updates.
For example, if you had a cafe you might want to post “Today’s special” on the front page of your site each day but if you have to log into the CMS every morning to do this you would probably just not bother. However, it is very easy to send it to Twitter using your phone at the same time that you chalk it up on the blackboard. All you need to do it place a small amount of Javascript onto the pages where you want this displayed which reads your Twitter feed and displays it. We use TwitterJS, a library hosted on Google code to display tweets from @wighthat on our home page – the code to add it is as follows.
At the base of the page (just before the </body> tag) insert the following:
<script src="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js"></script> <script type="text/javascript" charset="utf-8"> getTwitters('tweet', { id: 'YOURTWITTERNAME', // for example, ours is 'wighthat' count: 3, // the number of tweets to display enableLinks: true, // if you wish to display links ignoreReplies: true, clearContents: true, template: '%text% - %time%' // the format of the tweet, you can also use %date% }); </script>
Change YOURTWITTERNAME to the twitter account that you wish to display and place a div statement somewhere within the html with an id=’tweet’ where you would like the tweets displayed as follows:
<div id="tweet"></div>
Now the latest tweets will show on your site. You may wish to make a separate twitter account just for this so that it doesn’t get mixed up with your other tweeting such as @mycafespecials.
To increase visibility of your specials/ news/ offers, you can also link the twitter feed to your facebook account so that your friends on facebook can see the entries as well. Further information on how to do this can be found here.
It should be noted that this will not benefit your website in SEO terms. The tweets displayed will only be visible to human visitors as they are loaded from the visitors’ browser, search engine spiders will not see them. If we find there is significant interest we will develop a server side version of this to add twitter into the page so that search engine spiders can see it as well. If this is something that you might be interested in please let us know in the comment box below.
Next post: Beware of the Out of Office reply
Previous post: What the web looked like 15 years ago