How to put a Digg button in your every blog post automatically.:The Code of Blogging

How to put a Digg button in your every blog post automatically.

Digg provide button integration like the one below.

<script type="text/javascript">
digg_url = 'WEBSITE_URL';
digg_bgcolor = '#ff9900';
digg_skin = 'compact';
digg_window = 'new';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>

The digg_bgcolor – To change the background color outside the button. If omitted, the default color is white.

The digg_window - When set to 'new' will open a new browser window that will open Digg for submitting an article selected by your readers.

The digg_skin - Option controls the look of the button. If omitted, the default is the standard yellow button like the one you see here. If specified as 'compact', then a smaller horizontal visual design is used.

To simplify integration, I prefer to use the digg_url parameter alone and omit the rest. So the script above becomes;

<script type="text/javascript">
digg_url = 'WEBSITE_URL';
</script>
<script src=’http://digg.com/tools/diggthis.js’ type="text/javascript"></script>

All you have to do is replace the ‘WEBSITE_URL’ with the link of your post. (e.g. digg_url = ‘http://www.yahoo.com’) But this method requires you to post first your article then get the link to be use in the said digg_url.

What you can do is replace the ‘WEBSITE_URL’ with ‘<data:post.url/>’, this way blogger will load the current link of the blog post your visitor is currently viewing.

The tricky part here is how to put this script into your template so that it will appear automatically in all of your blog post . Please follow the procedure below for integrating the Digg button into your site.

Note: Be sure to “Download Full Template” first before doing the steps below.

  1. Open your Blogger Dashboard
  2. Click “Layout”
  3. Click “Edit HTML”
  4. Click “Expand Widget Templates”
  5. Search for <data:post.body />
  6. Then paste the script provided below just above the code you just searched.
  7. After previewing your template and no error then save your template.
<!-- DIGG BUTTON START-->
<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>
<!-- DIGG BUTTON END-->

Bookmark and Share

 

Circle of Friends