How to add social bookmarking features to your (Typo) blog
As you can see below I have added the social bookmarks buttons at the bottom of each article. The buttons are for the following sites.
The links will direct you to their widget page.
The code to add these buttons is:
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">
<img src="http://static.delicious.com/img/delicious.small.gif" height="50" width="50" alt="Delicious" /></a>
<script type="text/javascript" src="http://www.reddit.com/button.js?t=3"></script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script>
<a href="http://technorati.com/faves?sub=addfavbtn&add=http://harryseldon.thinkosphere.com">
<img src="http://harryseldon.thinkosphere.com/files/technorati.jpeg" alt="Add to Technorati Favorites" height="50" width="50" /></a>
<a href="javascript:location.href='http://slashdot.org/slashdot-it.pl?op=basic&url='+encodeURIComponent(location.href)">
<img src="http://harryseldon.thinkosphere.com/files/slashdot.jpeg" alt="Slashdot" border="0" height="50" width="50"></a>Notice that the one for technorati is special. I have not found exactly what I wanted. It favorites the blog itself not only the article. Therefore, this part of the code is not suitable for your blog ! You need to adapt it. For the other links they should work as such on your blog.
If your blog engine is Typo simply add the previous code to /themes/your_theme/views/articles/read.html.erb, typically after the line :
<%= render :partial => 'article', :object => @article %>And you which social bookmarking websites do you use ?
Posted in Ruby on Rails | no comments | atom
home
about
archives
