Friday, 3 October 2008

Hacking Blogger Beta: Adding Adsense, Digg Buttons And Anything To Every Post

I’ve received a lot of e-mails recently asking me how I’ve added the Adsense, Digg buttons and subscription links to every post on my site. Even though my site is quite customized now and doesn’t look like a standard Blogger.com blog (hopefully!) it is hosted by Blogger which doesn’t automatically provide the facility to add elements to every post.

However, it’s incredibly easy! So let’s go through it step-by-step!1. Go to the ‘Edit HTML‘ part of your blog’s Dashboard and backup your template by clicking ‘Download Full Template‘. Why? Because mistakes happen!

2. Click the ‘Expand Widgets‘ checkbox to show your complete template.

3. Do a search or scroll down to find “>post.body/> This piece of code represents the body of the posts in your blog. Hence, adding Adsense code immediately before this will result in your Adsense ads being displayed between the posts title and body. Adding Adsense code immediately after this will result in the ad being displayed between the body and comments links. For Adsense to display correctly, you’ll need to remove the tag from the Adsense code

4. Save it and take a look at your blog! You should have now have Adsense incorporated into your posts.
Remember, Adsense limits the number of text/image ads to three per page. So if you’re just using the ads in the posts, it will only display for the first three posts. Similarly, if you’re displaying ads in your sidebar the number of ads displayed in posts will be limited.

Also remember that when it comes to sidebars, your blog is read from left to right. Therefore, if you have more than two posts displayed on a page and Adsense code in your right sidebar, the right sidebar ads will not display. Adsense will display the ads in your first three posts and then not be able to display it in the sidebar.

No problem!
Adding Digg buttons to your posts is exactly the same process. You can find a whole lot of buttons to display by going to the Digg site or clicking here. However, most of these are purely links to the Digg homepage. The best piece of code that I’ve found is this one:


http://digg.com/tools/diggthis.js‘ type=’text/javascript’/>


This piece of code is the best as it enables your readers to not only ‘Digg’ the post from your site but also to submit the permalink of your post to Digg. And it will display for every post.

Simply by adding any code you like to the appropriate part of you template, you can add anything you like automatically to all of your posts! For example of how it can look, simply look at the end of this post!

Happy customizing!

0 comments: