Wednesday, May 02, 2007

Add to Favorites/Digg This Hack

Ramani at Hackosphere suggests a hack for adding links to del.icio.us and DiggIt to the bottom of your posts.

I have altered this slightly to float a 'DiggIt' link to the right, separating it from the post labels which are left aligned. You can see this in place at the bottom of this post. You could add any link you like, replacing the digg url "http://digg.com/submit?phase=2&url=" with one of your choice as well as replacing the "DiggIt!" text with an image.

The text in normal font is the original blogger code, the text in bold is the Hackosphere code and the text in red is my additional code.

<span class='post-labels' style='float:left;'>
<b:if cond='data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'>
<data:label.name/>
</a><b:if cond='data:label.isLast != "true"'>,</b:if>
</b:loop>
</b:if></span>
<span class='post-labels' style='float:right;'>
<a expr:href='"http://digg.com/submit?phase=2&amp;url=" +
data:post.url + "&amp;title=" + data:post.title'
target='_blank'>DiggIt!</a>
</span>

I will not repeat the full instructions for implementing this, as it is explained well on the the Hackosphere post, but refer you to the post itself: Hackosphere: Del.icio.us and Digg hotlinks for your Beta blog.

0 comments:

Post a Comment

I have removed 'nofollow' in appreciation for you taking the time to comment.