AddThis button in your posts

From Bloggerhacks

Revision as of 00:38, 15 February 2008 by Harvey (Talk | contribs)

Contents

Platform

Specifically for use with Blogger blogs.

License

Creative Commons Attribution Share-Alike 2.5

Required Skills

You should be able to edit and save your Blogger template file.

Other Requirements

You need an AddThis account/username to use this hack. Don't worry, it's free.

==Description== What does it do? This hack, through use of a JavaScript code snippet, will add an AddThis button to each of your posts. AddThis is a free social bookmarking sharing tool and provides a one button for all functionality to your blog.

Method

  • Open template file: on your dashboard, go to Layout | Edit HTML to open your template file.
  • Create a backup of your template: click Download Full Template to download a backup copy before editing your template file (just in case).
  • Check Expand Widget Templates to see the full template.
  • Search for the following lines of code (you will insert the AddThis code, i.e. the hack, above these lines):
</div>

<div class='post-footer-line post-footer-line-2'>
  • Insert the hack so that the result looks like this:
<!-- HACK BEGINS HERE -->
<script type='text/javascript'>
  expr:addthis_url    = '<data:post.url/>';
  expr:addthis_title  = '<data:post.title/>';
  expr:addthis_pub    = 'USERNAME';
</script>

<span style='float:right; display:inline;'>
  <script src='http://s7.addthis.com/js/addthis_widget.php?v=12' type='text/javascript'/>
</span>
<!-- HACK ENDS HERE -->

</div>

<div class='post-footer-line post-footer-line-2'>
You'll want to replace USERNAME (line 5) with your AddThis username.
  • That's it! Just click Save Template and watch the result.

Sites Using This Hack

See Also:

Personal tools
FreshTags