Add social bookmarks to dasBlog

Nov 2, 2006

As you can see at the bottom of each blog post, I’ve added social bookmark links. Because I use dasBlog version 1.8 it was very difficult to do, mainly because there is no macro to print out the title in clear text of the individual blog posts. Michal showed us how to add the macro to dasBlog in a very easy way. The only problem is, that I’ve uninstalled Visual Studio 2003 and I don’t want to install it again just to add a macro to my blog.

I knew that the only way to do it was by JavaScript and I didn’t like it at all. But in the end, it turned out pretty good. This is the JavaScript that I added to the footer of the ItemTemplate:

<script type="text/javascript">

  var tn = document.createTextNode('<%ItemTitle%>');

  var div = document.createElement('div');

  div.appendChild(tn);

  var html = div.innerHTML;

  var index = html.indexOf('&gt;') +4;

  var title = html.substring(index, html.length - 10);

  var social = '<div style="float:left">';

  social += '<a href="http://digg.com/submit?phase=2&url=<%permalinkUrl%>&title=' + title + '">Digg it</a>&nbsp;|&nbsp;';

  social += '<a href="http://www.dzone.com/links/add.html?url=<%permalinkUrl%>&title=' + title + '">dzone it</a>&nbsp;|&nbsp;';

  social += '<a href="http://www.dotnetkicks.com/submit?url=<%permalinkUrl%>&title=' + title + '">Kick it</a>';

  social += '</div>';

  document.writeln(social);

</script>

You can fairly easy add other bookmarks than the ones I’ve implementet. If you use the new dasBlog 1.9 you don’t have these problems, because it come with the blog post title macro out of the box.

>* $4.95/month BlogEngine.net Hosting – Click Here!

Comments (6) -

 Gavin Joyce
Gavin Joyce
11/7/2006 12:40:52 PM #

The following URL is preferred for dotnetkicks.com as it helps avoid duplicate posts:

http://www.dotnetkicks.com/kick/?url=[URL]&title=[TITLE]

 Andrew Jackson
Andrew Jackson
11/8/2006 9:59:27 AM #

Very nice idea, doesn't seem to like it when you have a single quote in your blog item title, I'm sure a bit of javascript replacement/extra quote wrapping would cure it but I'm not that up on javascript to solve this one as yet.

btw, nice blog.. I think your the number one blog I read where I actually take stuff and use it in my own projects.

Chris May
Chris May
11/26/2006 6:04:33 PM #

Mads,

Thanks for sharing your code!

I made a few changes (removed the title b/c of the single quote problem, and fully encoded the URLs), and added a few more sites to the list.

My code can be found here:
www.chrismay.org/.../Social+Networking+Links.aspx

Chris May

Mads Kristensen
Mads Kristensen
11/26/2006 6:43:25 PM #

Thanks Chris. Thats very cool

 翻译公司
翻译公司
3/8/2007 9:58:24 PM #

Hello I like your page is interesting...
10/325 - Vicoprofen - Lortab- Tylenol #3- - Ativan
All Major Medications are available right here at:

 货架
货架
3/8/2007 9:59:14 PM #

In the same calification we can find drugs like!

Comments are closed

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.