How to show adsense ads only on home page and not on inner pages of your blogger blog?

by Ankur Jain on December 23, 2008

Here I assume that you are using the blogger beta and not on the classic one. It’s been a long time now that blogger has moved to beta. There is no reason for you to remain on classic version now.

You want to show adsense ads on sidebar of the home page of your blogger blog and not on the other pages OR you want to show adsense ads on all pages except the homepage of your blogspot blog. Here is what you can do-Add a Blogger Gadget

  1. LogIn to the blogger dashboard. Go to Layout. Say you want to show ad on the left sidebar top. Click on “Add a Gadget” on LHS of layout and enter your adsense code. 
  2. Now go to Edit HTML. Scroll down and locate left sidebar. You will find something like this- Adsense ads only on homepage
  3. Copy the name of the first widget. In my case it is HTML6.
  4. Now click on Expand Widget Templates (given on top right) and search the name you have copied in the above step. Adsense ads on home page  
  5. You will find a similar code except what is in the red box above. Copy and paste  <b:if cond=’data:blog.pageType == &quot;index&quot;’> and </b:if>, EXACTLY at the same place as shown in the image above.
  6. If you want to show ads on all pages except on the home page then copy and paste this <b:if cond=’data:blog.pageType != &quot;index&quot;’>

Save Template’ and you’re done.

Gozar!

{ 12 comments… read them below or add one }

Chris December 24, 2008 at 1:27 AM

Thank you very much for this tip. However, I couldn’t get it to work at first because the single quotes you use in the text do not work in html. I finally figured that out and once I changed the single quotes to ‘ then it worked great. THX

Reply

James December 24, 2008 at 10:52 AM

Great article, thanks for the advice will definitely look at it for my next project.

Reply

Sarah January 4, 2009 at 3:18 AM

2 questions:
1) How can I get a comment box like yours?
2) How can I get a widget to show up on all my pages except 5 label pages (the page that shows up when you click on label)…

Reply

ROW January 4, 2009 at 10:03 AM

1) I see your blog is hosted on Blogger platform. Blogger provides an option to either make comment box open in a pop-up window OR on the same page. You can change settings from the dashboard.

2) I think the trick should be same as shown above except that you would need to write the full href for those 5 label pages in the if condition.

Reply

Sarah January 5, 2009 at 10:24 AM

Thanks, but how to do you give readers the ability to receive an email notification to responses? Are you not hosted on blogger?

Reply

guest January 7, 2009 at 6:49 PM

nice ;) tnx!
but when I click on my labels it shows me anyway my gadget …it works only whan I click on my post title
any suggestion?
tnx

Reply

Avinashtech January 26, 2009 at 1:32 PM

i am trying to put the ads just below tiles of posts on home page and i am partially successful too but my problem is , after showing three adsense ads in 3 posts, the other posts on home page show Blank space( same size as that of adsense).. any help?.Mine is a customised template

Reply

ROW January 26, 2009 at 2:36 PM

@AvinashTech: This is because adsense TOS does not allow you to put more than 3 ads(ad units) on a single page.

If you are trying to embed ads withing posts, my suggestion is to go for ads only on your inner pages and not on home page.

Reply

Avinashtech February 7, 2009 at 8:26 AM

Thanks ROW,
I was aware of that 3 ads limit of adsense as per adsense TOS. Do you know by anyway can we achieve that on home page with 3 ads only but no blank spaces left after 3 ads?

Reply

tips November 7, 2009 at 9:00 AM

this is very useful code,but i have question.can we use this code on wordpress blog?

Reply

ROW November 9, 2009 at 5:51 PM

For wordpress blogs you can use any of the adsense plugins available for free, you dont need such tweaks for wordpress.

Reply

Tomas September 23, 2011 at 4:31 PM

Thanks for the tip, Every page of my blog (wordpress) shows adsense ads except the header (home page, about, contact and articles doesn’t show up. Do you have any suggestion what widget can be used for my blog? thanks.

Reply

Leave a Comment

Previous post:

Next post: