One of my friends recently approached asking me to help him to hide Adsense ads on the home page of his blog and display them only in the individual article pages. It is a good idea to remove Ads from home page and display them in the article pages to give a professional look to the blog.
He motivated me to write this article and share the information of how to configure Blogger blog template to display ads only in the post pages alone. Let us see the steps to be followed for modifying the template to implement this
- Log in to Adsense
- Generate code required for displaying appropriate ads on you blog and paste it to a notepad
- After pasting the code to the notepad, remove the line breaks and comments from the Adsense code. Make sure that you code looks like the following (do not to modify any script of Adsense, just remove the line breaks and comments alone)
- Your Adsense code is ready now. Lets modify blogger template
- Log in to your blogger account select Layout of the blog which you want to modify
- Navigate through Template --> Edit HTML
- Take backup of your template by clicking Download Full Template. This backup will help you if you want to revert to old template
- Select Expand Widget Templates option to get access to the full code of the template
- Search for <data:post.body/> in the template HTML and place the following before the <data:post.body/>
<b:if cond ='data:blog.pageType == "item"'>
<!-- Paste your adsense code prepared in step 3 here -->
</b:if>
- Replace the text <!-- Paste your adsense code prepared in step 3 here --> with the adsense code which you prepared in the step 3 using notepad.
- After completing the replace operation, code in your template should look similar to the following
<b:if cond='data:blog.pageType == "item"'>
<script type="text/javascript">google_ad_client = "pub-asdfsadff";google_ad_slot = "123123123";google_ad_width = 336;google_ad_height = 280;</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
</b:if>
<data:post.body/>
- Save the template by clicking on Save Template button
- That's all. Your Blogger template is configured to display ads only in the post pages
Troubleshooting Guide
Why Ads are not displayed?
This happens if you modify any attributes of Google Adsense ads by mistake while removing the comments and line breaks. To solve the problem, get the Adsense code again from Google Adsense and remove the line breaks and comments carefully.
Why Ads are displayed in a table with borders around them?
This happens when the line breaks and comments are not replaced from the Adsense code pasted in Blogger Template. Remove all the line breaks and comment start tags and end tags to solve the problem.
If you face any other problems, please post a comment. We will help you to solve the problem.



