February 06, 2008

Adding a unique digg button per post using Blogger

Adding a digg button to your blog on blogspot is easy, and users can digg the blog, or even digg an individual post, provided they were drilled into a specific post. But what if you want your readers to digg any specific post from your main page? If you have a following, that's probably where they'll read it from, and a digg button on your main page will only take them to digging the blog in general. Basically, you'll want to have a button inside each posting with a digg_url that is specific to that post.

Here's a way I found to get it to work:

Go to your blog's admin page and select the Template tab
Select Edit HTML
Make sure "Expand Widget Templates" is checked
Look for the <div class="post-footer"> div tag
Inside that tag, add your digg button code
For the digg_url value us e <data:post.url/>(This template variable holds the actual url of each individual post)
Note: The code window will encode the quotes.

Here's some sample button code and more digg integration info if you need it.

...Of course if you use it, you have to digg me :)

<!-- digg button with post-specific url added - Dan Shultz -->
<script type='text/javascript'>digg_url = '<data:post.url/>'; digg_title = '<data:post.title/>'; digg_bodytext = ''; digg_skin = 'compact'; digg_window = 'new'; digg_media = 'image'; digg_topic = 'comics_animation';
</script>
<script src='http://digg.com/tools/diggthis.js' type='text/javascript'/>
<!-- end digg button code -->

Share |

2 comments:

  1. couldn't find a way to digg this post... Maybe if there was a button.... hummmmm.... :P
    good post.

    ReplyDelete
  2. Damn, you're fast, you beat me to it.

    ReplyDelete