Sunday, January 13, 2008

Adding social bookmarking links to blogger

I recently wanted to add social bookmarking links to all of my blog posts. As you might notice my blog is hosted on blogger, only way I could do that is by editing the template. I thought I would share how to get about editing the template such that you add social bookmarking links which will automatically add the post permalink and the title if possible.

To edit the template, Sign into your blogger.com account and goto Template -> Edit HTML and then select Expand Widget Templates. Search for <data:post.body/>, just after <data:post.body/><div style="clear: both;"> <!-- clear for photos floats --> insert the following code.

<!-- Start of social bookmarks -->
<div class='service-links'>
<div class='service-label'>Bookmark this post with: </div>
<ul class='links'>
<li class='service_links_digg'><a class='service_links_digg' expr:href='"http://digg.com/submit?phase=2&url=" + data:post.url + "&title=" + data:post.title' rel='nofollow' title='Digg this post on digg.com.'><img alt='Digg' src='http://mohanjith.net/images/service_links/digg.png'/></a></li>
<li class='service_links_stumbleupon'><a class='service_links_stumbleupon' expr:href='"http://www.stumbleupon.com/submit?url=" + data:post.url + "&title=" + data:post.title' rel='nofollow' title='Bookmark this post on StumbleUpon.'><img alt='StumbleUpon' src='http://mohanjith.net/images/service_links/stumbleupon.png'/></a></li>
<li class='service_links_delicious'><a class='service_links_delicious' expr:href='"http://del.icio.us/post?url=" + data:post.url + "&title=" + data:post.title' rel='nofollow' title='Bookmark this post on del.icio.us.'><img alt='Delicious' src='http://mohanjith.net/images/service_links/delicious.png'/></a></li>
<li class='service_links_reddit'><a class='service_links_reddit' expr:href='"http://reddit.com/submit?url=" + data:post.url + "&title=" + data:post.title' rel='nofollow' title='Submit this post on reddit.com.'><img alt='Reddit' src='http://mohanjith.net/images/service_links/reddit.png'/></a></li>
<li class='service_links_newsvine'><a class='service_links_newsvine' expr:href='"http://www.newsvine.com/_tools/seed&save?u=" + data:post.url + "&h=" + data:post.title' rel='nofollow' title='Submit this post on newsvine.com.'><img alt='Newsvine' src='http://mohanjith.net/images/service_links/newsvine.png'/></a></li>
<li class='service_links_facebook'><a class='service_links_facebook' expr:href='"http://www.facebook.com/sharer.php?u=" + data:post.url + "&t=" + data:post.title' rel='nofollow' title='Share on Facebook.'><img alt='Facebook' src='http://mohanjith.net/images/service_links/facebook.png'/></a></li>
<li class='service_links_google'><a class='service_links_google' expr:href='"http://www.google.com/bookmarks/mark?op=add&bkmk=" + data:post.url + "&title=" + data:post.title' rel='nofollow' title='Bookmark this post on Google.'><img alt='Google' src='http://mohanjith.net/images/service_links/google.png'/></a></li>
<li class='service_links_yahoo'><a class='service_links_yahoo' expr:href='"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + data:post.url + "&t=" + data:post.title' rel='nofollow' title='Bookmark this post on Yahoo.'><img alt='Yahoo' src='http://mohanjith.net/images/service_links/yahoo.png'/></a></li>
<li class='last service_links_technorati'><a class='service_links_technorati' expr:href='"http://technorati.com/cosmos/search.html?url="+data:post.url' rel='nofollow' title='Search Technorati for links to this post.'><img alt='Technorati' src='http://mohanjith.net/images/service_links/technorati.png'/></a></li>
</ul>
</div>
<!-- End of social bookmarks -->

Add the following code before ]]></b:skin>.
/** Service links style **/
.service-links {
padding-top: 3px;
}
.service-links ul.links {
margin:0pt;
padding:0pt;
}
.service-links ul.links li {
display:inline;
list-style-type:none;
padding: 0pt 0px;
background: none;
}
.service-links ul.links li img {
border: none;
padding: 3px;
}

Then save the template. Adding social bookmarking links and submitting your posts to social bookmarking networks would improve the visibility of your blog and help drive traffic to your blog.

11 comments:

mohanjith said...

Testing OpenID Seatbelt from VeriSign

AppsMan said...

It does not work at all..i tried 6 times...same error message

XML error message: The reference to entity "url" must end with the ';' delimiter.

Melfi said...

i keep getting the same message as well

mohanjith said...

appsman and melfi, did you put the html in the proper place as mentioned. I seem to have no issue with this code.

Duncan Borrowman said...

Same error here

Aditya said...

same aerror as other users are getting.

Renee said...

Getting the same error as well :(

Heather said...

to correct the error check out:
http://woork.blogspot.com/2007/10/blogger-hack-add-delicious-button-with.html#comment-1403478999955920535

just a simple xml correction
(change all of the & to &)

Heather said...

oops... :O

that's change all of the
&
to
& a m p ;
(the ampersand command for ampersand)

pneyu said...

Worked beautifully with the workaround--thanks!

rakastar said...

Tervetuloa takaisin sosiaaliseen verkostoon! Tämä sivusto on esimerkki, miltä sinun sosiaalisen verkoston sivusto voi näyttää. http://www.naz.net