Follow up to Pulling Twitter Feeds

This is a follow-up post to my first one offering a method of displaying your Twitter feed either in wordpress or a static html page.

I got quite a few comments and questions asking how to make links in tweets clickable. After a bit of head scratching and searching around, I found that soccio.it has managed to re-write the original Twitter blogger.js javascript file to make both http:// links and @replies clickable.

You will of course need a copy of the modded blogger.js file – you can get it from soccio.it, who will even let you hotlink it as well. Personally I always think it is better manners to host it yourself, but its up to you.

Get the javascript here. Hotlink url is: http://www.soccio.it/code/twitter/blogger.js

Select all, copy, paste into a notepad file and save that file as blogger.js – upload to the site/directory you enter in the code snippet below.

The only other change is in my original first step, where you need to alter the url of the blogger.js file to one on your host, as per example code below.

<!-- Twitter JS -->
<script src="http://CHANGE_TO_YOUR_SITE_URL.com/blogger.js" type="text/javascript"></script>
<script src="http://twitter.com/statuses/user_timeline/USER_NAME.json?callback=twitterCallback2&count=5" type="text/javascript"></script>
<!-- End Twitter JS -->

Hopefully an easy straightforward solution to an annoying little problem! (You can now revert back to the original instructions, disregarding step one…)

I’ve modified my now self-hosted blogger.js file slightly further to make target=_blank and also make the links nofollowed. Simply look for the following line:

posttext = twitters[i].text.replace(regular, '<a href="$1">$1</a>');

and change it to read:

posttext = twitters[i].text.replace(regular, '<a target="_blank" rel="nofollow" href="$1">$1</a>');

Enjoy!

Like this post? Bookmark or share it:

 

Previous/Next posts:

5 Responses to “Follow up to Pulling Twitter Feeds”

  1. [...] Follow up to Pulling Twitter Feeds [...]

  2. Thanks you for the post – it works like a dream in my normal html page. There is one thing though – the URL that show in my tweet, it adds another http://. So when I click on it, the page fail to open in a browers because of the URL that have http://http://url. Do you know what I can do to fix it?

  3. @semblance – no idea why you’re getting that issue, works just fine for me!

    Not that it should make any difference, but I always copy and paste the link into the twitter input box on their site…that said, I have also typed it in manually on my iphone/twitter app.

    I’m assuming that you altered the blogger.js file to the updated one mentioned in this post?

    As the saying goes, good luck bro’

  4. Hi,
    Is there any way we can omit @replies in the feed?
    Thanks

  5. Its not validating xhtml, showing following message…

    cannot generate system identifier for general entity “count”

    s/user_timeline/site.json?callback=twitterCallback2&count=2″>

    An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URL

Leave a Reply