Using del.icio.us to display links on your website
Originally I had written a link manager into the admin for this site until I decided del.icio.us was the best way to manage my bookmarks.
The reason for this is because using the del.icio.us firefox extension combined with the Foxylicious extension means I can have 'live' bookmarks, shared across any browser, grouped by the tags I use.
The firefox extension means I can add a bookmark to del.icio.us via a button on right on the browser. This is a lot easier than logging into my admin everytime I want to add a link. In fact, I was considering writing some code to enable me to email a link and it be automatically submitted to my site.
The links from my account are pulled by using a JSON object from del.icio.us. This enables me to take my last 10 bookmarked webpages tagged with the term 'site'.
The javascript i've used is:
<ul>
<script type="text/javascript" src="http://del.icio.us/feeds/json/timberford/site?count=5"></script>
<script type="text/javascript">
/* <![CDATA[ */
for (var i=0, post; post = Delicious.posts[i]; i ) {
document.write("<li><a href=\"" post.u "\" target=\"_blank\" title=\"Opens in a new window\">" post.d "<\/a><\/li>");
}
/* ]]> */
</script>
</ul>
Using CDATA stops the validator from choking on the xhtml written in the javascript.
Foxylicious isn't necessary for getting the links posted onto this site, but it played a large part in convincing me to use del.icio.us. Basically it plants all your bookmarks direct into where all your 'normal' bookmarks sit with them grouped by the tags you use. Essentially I no longer need to bookmark direct to the browser when I can do it to del.icio.us and access them from anywhere.
About
Paul is a web developer for Kyanmedia web agency. He's lucky enough to write in Ruby on Rails full-time and uses this site to post snippets of code.
Contact
my name at gmail.com
More snippets
Take a look in the archive
Need a website?
Contact my employer. Make sure to check out our portfolio of work.
Hosting
I recommend hostingrails.com
No comments have been left
Got something to say?