In the last couple of years, many blogs have added links to submit stories to
Reddit,
Digg,
del.icio.us and others to posts. Some use simple links, while others use a little widget which indicates whether the article has been submitted, and if so how many votes it has received, like the one
Many blogging platforms make it very easy to add these; there are a number of plugins available for Wordpress to do it, for instance, though, of course, they may or may not add significantly to page load time, make ten database queries per page, or stop working abruptly for no obvious reason. Wordpress is a bit like that.
There's no immediately obvious way to do it with the new version of Blogger, however. Google has been changing it quite quickly, so that even the 'Blogger Beta' in common use a few months ago was quite different to the current Blogger. Reddit even
claims that you can't use the widgets, or buttons, on the new Blogger.
It turns out to be possible, although it's not immediately obvious, and requires some editing of your template code. As I wasn't able to find any other up-to-date guides, I decided to write about it. Before you start, be sure to save a copy of your template, so that you can revert if you break it. You can do this by clicking the
Template tab and clicking
Edit HTML, then clicking
Download Full Template.
Now, still on the HTML editing page, check the
Expand Widget Templates box
. Search for
post-body in the editing box. Now you should consider what you want to add, and where. You can add either the buttons, or the links, or both. If you put the code above the
<data:post.body/> tag, the items will (barring very odd CSS usage) appear above your article; if you put it below, they'll appear below.
Here's the code for simple links to add an article to some popular services:
<a href="http://www.blogger.com/%27" url=" + data:post.url + " title="" target="'_blank'">Submit to Reddit</a> -
<a href="http://www.blogger.com/%27" phase="2&url=" title="" target="'_blank'">Submit to Digg</a> -
<a href="http://www.blogger.com/%27" title="" target="'_blank'">Add to del.icio.us</a>
And here's the code for the elusive Reddit button.
<script>reddit_url='<data:post.url/>'</script>
<script>reddit_title='<data:post.title/>'</script>
<script language='javascript' src='http://reddit.com/button.js?t=1'/>
The code for Digg should be similar.
By the way, while I'm obviously irritated about having to find all of this out by trial and error, I think that Google did the right thing by replacing Blogger's template language; the new one is far more versatile. They really need to document it better, though.