Thursday, August 23, 2007

How to add a Digg This button in Blogger and Wordpress

I know this information is out there, but I wanted to put it in one place. For my convenience, because I have both a blogger blog and a Wordpress blog.

I like them both for different reasons. I'm using a regular blogger account and a Wordpress.com (free) account. I am not hosting my Wordpress blog.

There are limitations to both, but both work just fine.

IMPORTANT: You will need to register at digg.com so you can start digging stuff.

For Blogger:
I have found a couple of ways to do this. The way I am using is to add the Digg This button to every post by modifying the template.

Blogger does not allow javascript in posts, and that's the only way Digg.com offers the button, so you'll have to add it to the template, which adds it to every post. If you don't want this, then this article will not help you. If you figure out a way to add the button to individual posts, let me know.

I guess I'm supposed to say here that you should save your template to your hard drive before modifying it. I haven't done that yet, but it's up to you.

So, Go to your dashboard, click the Template tab, then Edit HTML.

Click "Expand Widget Template"

You will need to find this piece of code:

<p><data:post.body/></p>

It is about half way down. (tip: you can search the page in firefox and explorer on the mac by typing "apple" "f" and on Windows by typing "ctrl" "f", then typing "data:post.body" and it should find it.

Then copy the code below this sentence and replace the above piece of code completely (take a good look at this code, you can see it adds the replaced code back in)

<p>
<!-- DIGG -->
<div style='float:right; margin-left:10px;'>
<script type='text/javascript'>
digg_url = '<data:post.url/>';
</script>
<script src='http://digg.com/tools/diggthis.js' type='text/javascript'/>
</div>
<data:post.body/>
</p>

Now, understand this...this code will add a button to all your posts with a "zero" diggs displaying until someone diggs it, and so, you can go and digg your stories first, or wait until one of your readers do it.

The Digg This button will be placed "align=right", top right corner of your post, so if you tend to put large pictures opening your post, you might want to make them smaller (less width).

For Wordpress.com
Unlike Blogger, you can add a Digg This button to individual posts.

You will need to write your post first. Publish your post, and copy the url of the post.

Go to Digg.com and submit a new post.

Paste the url you just copied into the field asking for where the story is from.

Fill in the rest of the fields, and look through the articles they might claim might be the same.

Once you get the "success" message, copy the url.

Now go back to your post and add this to it: [digg=http://YourPostURL]. So basically you are adding [digg=] and then pasting your dig submission url into the space after the equals sign.

The Digg This button will be placed "align=right", parallel to where you placed the code.

Hope this helps.

What do you think?
1. Do you know of a way to add the button to indivicual posts in Blogger?
2. How often do you Digg stories?
3. Are you using Blogger or Wordpress?

27 comments:

Girish Bhaskaran said...

Good post, mate. I've been wondering how people use this digg and del.icio.us links on each of their posts. you are helping a lot of newbies with this post.

Jorge said...

Right on! Glad to help.

Kaushal said...

Hey good article - quick Q though - I could import the link but NOT the header and body -- this sucks. How can I import this as well so that it is a single click operation.

Jorge said...

Kaushal, not sure how to answer your question, but I went to your site and it looks like you figured it out. Maybe. Let me know.

jorge

OttoMoBiehl said...

Thanks for the great post. It was easy to do.

Al said...

Thanks for a great post, I've wanted to add this since I started (not that long ago), and couldn't get one that worked. Do you have a good place to find solid templates? I had a decent one but it kept acting up. Anyway, thanks again for informing us!
Al

yugu said...

hai can u tell how to add design float button to the blogspot

Jorge said...

Well, I have no idea what you are talking about. I googled "Float Button Blogspot" and didn't really find anything either. Please elaborate.

jorge

yugu said...

I mean how to a designFLoat button (float it) www.designfloat.com button

Ruel Jamarie said...

Great tip Papi! I've successfully implemented this digg button.

One thing though, it kinda ruined the alignment of in-post images but no worries... I think I can manage.

Thanks!

Raaz said...

hi good post.. it is working now in my blog and i have a one more doubt. ihave created a widget like stories from papi(in your blog) and posted it into my blog but it seems it is not working will you able to answer me at bodlarajesh2000@gmail.com..FYI please see my blog sriraaz.blogspot.com/. and suggest me asap. thanks in advance

Kathiravan said...

Hi your code is working fine for me. but i want to add link instead of image (for example Add to Digg)? can u tell me?

Harsh said...

I wanted to ask how to add a DIGG THIS button to every post on Wordpress (like blogger)

Hey this adds a Text type link to Digg-This :
Go to Digg's Site :
http://digg.com/tools
(I wrote it this way because blogger wouldn't allow me to add scripts directly)

Jon said...

Great explanation, I was messing about with div align etc., never thought to use float. Cheers!

HasH KhaN said...

Thanks a lot Jorge... i was really sucked by searching on how to add the digg button. i tried lots of steps from others but none worked. Finally you came to the rescue. only your code works. Hats off..! i have installed it on my blog http://cmhashim.blogspot.com

Linerd said...

Thanks a lot! I'm just starting my blog and I couldn't figure out how to get the button to link to the specific post. I'll be checking your blog to see what else I can learn.

http://linugadgetech.blogspot.com/

Liviu said...

Hello,

After reading your post and doing some research on my own, I implemented the solution as you described it here.

Good post! Very useful! Thank you!

luisj said...

thanks for your help.
Now I would know, if possible, how to put the digg button in the blogger fron page (you have it) in all posts that appear there.
I use your tip but I only get the digg button in the post page (when I'm browsing the post itself) not in the front page of the blog.
Thak you very much.

JesusFreak said...

Thanks mate..I like your type..You are the man..You can take time to check out my blog at http://www.spiritofjesus.blogspot.co and my friend's blog on http://ogbongeblog.blogspot.com

Your comments will be appreciated on both

Thanks

James Wee said...

AWESOME POST !!
AAAA+++

Keep it up mate. Very helpful!

james.pyles said...

Thanks for the tutorial. The Digg badge starts out with no numeral at all in the badge; just the word "Digg" and a "submit" link. After I go through the process of digging a blog post, One "digg" shows up, but the submit link is gone, replaced by a greyed out "dugg". I've logged out to see if the submit link returns, but nothing changes. Is this the desired behavior? How will other readers be able to "digg" an already "dugg" post?

Cheers,

James

Elizabeth Symington said...

Hi Jorge,
I created a simple tutorial on how to ad the Digg this button to individual posts. Thanks for steering me in the right direction.

http://weirdandsurprisinglygood.blogspot.com/2009/02/how-to-add-digg-this-button-after.html

Nadine M. Rosin "The Healing Art of Pet Parenthood" said...

Hmmm...I did the search AND looked manually and that particular code does NOT appear anywhere in my template html. :( Can you help? TIA!!!

PhotoSam said...

Very useful. Any way I can get the compact digg button instead (Wordpress)?

bang said...

Great! i've found this for a long time and now i find it here.Thank you.
Please see my blog-blog for search tour, hotels, resort,beautiful places in Vietnam: http://www.placesearch.blogspot.com (sory my blog is now simply)

Music Freak (MF) said...

Thanks buddy, got it well on my blog, Thanks for the useful info, earlier made my hands dirty with xml but did not get it right. Cheers,!!

Music Freak!
Download Hindi Songs

kosmos said...

Excellent work. I added buttor to several blogs.

TIP: Use date with comments.