Thursday, May 14, 2009

How To Show Ads Only On Post Pages

Earlier today Mohamed Rias posted a great hack in his blog for Blogger blogs. It is a modification of Ramani's expandable post hack which display a thumbnail along with the post summary. So for those who use pictures or photos extensively in their posts, this hack would be very useful. First, it would help increase the CTR as only as summary of the post would be visible on the main page, and to view the entire post the reader needs to click on the "Read more..." link which would take him to the post page. Secondly, it would help increase the aesthetic beauty of the blog by displaying the thumbnails.

Now while I was talking with Rias about this hack, I saw a slight glitch in it. For those who use Adsense, they would only be able to display a maximum of 3 posts on the home page. That is because whether you add the Adsense ads from Blogger Dashboard, or directly into your Blogger template, it would be displayed outside the "Read more..." link. And you can display only as maximum of 3 similar Adsense ad units on a single page. So when I pointed it out to Rias, he said why not show the ads only on the individual post pages, which was a brilliant idea as then one can apply the hack that Rias had posted and display more than 3 posts on the home page. I tried it on my test blog and was successful. And here's how to show Adsense ads only on the post pages in case you too would like to try the same.

Go to your Blogger Dashboard and then go over to your Layout page. From there click on Edit HTML. Check Expand Widget Templates and find the following line of code :


Now place the following line of code right after the above line :

<b:if cond='data:blog.pageType == &quot;item&quot;'>
Parsed Adsense code here

After adding that, save your template. Now when you would view the home page of your blog, no ads would be visible, but on the individual post pages the Adsense ad would be visible below right below the post.

I would like to thank Rias for such a brilliant hack.

[P.S. The above hack works not only for Adsense ads, but also for Chitika and Adbrite ads. Before trying out either my hack or Rias' hack, be sure to backup your template. And you can parse your ad codes from here.]

5 Comment:

rahil bhimani said...

Hello, i am glad to read the whole content of this blog and am very excited and happy to say that the webmaster has done a very good job here to put all the information content and information at one place, i will must refer this information with reference on my website i.e www.electrocomputerwarehouse.com

photo effects said...

very well steps but i want only display post page nothing else be display ads when the post page is open else display every where i like

Awais Akram said...

Thanks budy it works.thanks alot

Fatboy Bean Bags said...

I have been wondering how to do this for ages. I just tried it on my own bloag and it works like a charm. Thanks ever so much

historical places of pakistan said...

Social bookmarking submission has developed into a powerful tool for SEO experts. It involves linking sites within the various forums, blogs and message boards on social networking websites, blog sites and content centric sites like Digg. Considered a better alternative to submitting a website on blogs, manual social bookmarking is a simple, convenient and hassle-free way of making sure that your site is noticed and marketed in the right circle.

Post a Comment

Blog comment guideline