HOW TO PLACE ADS ONLY IN INDIVIDUAL BLOG ITEM PAGES
Advertisement
Many of you might have noticed in some blogs that when the posts are displayed at the front page of the blog there are no advertisements in that post. But when you click on the post header, it takes you to the post page where the whole post is shown as a single item and some advertisements appear below the header or after the post.

Place Advertisements in Individual Post Pages!
Well you can also do this in your blog. Whatever be the advertisement, be it Google Adsense, Text-Link-Ads, Adbrite, ShoppingAds etc. Just follow the steps given below and you can also show advertisements in the individual blog posts page.
This is a cool trick because when the posts are displayed at the front page its takes less space and the display is much distracting. You can make your advertisements appear above the or below the actual post content only if the users clicks on the article link and goes to the individual article page.
STEP 1 :Back-Up you existing Template. This is extremely important as you are going to play with the code and if something bad happens you can always revert back to your existing template.
If you don't know how to make a backup of your template follow these steps.
- Go to Blogger Home
- Now go to Layout >> Edit HTML
Layout >> Edit HTML - Click on the Download Full Template link and save the XML file in your system. If something bad happens you can upload it again and can restore the existing template.
Always Take a Backup of Your Existing Template Before Playing With It!
STEP 2 : Get the Advertisement code snippet ready. Let take for example a Google Adsense snippet, which is of dimensions 468 X 60. The code snippet for this will be like this.
<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 468x60, created 8/21/08 */
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 468x60, created 8/21/08 */
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
STEP 3 : Now go to Blogger Home. Navigate to Layout >> Edit HTML.

Layout >> Edit HTML
STEP 4 : Remember to select the check box Expand Widget Templates.
STEP 5 : Find the piece of code as shown below.
<div class='post-body' expr:id='"post-" + data:post.id'>
<p><data:post.body/></p>
<p><data:post.body/></p>
STEP 6 : Now replace the above given code with the piece of code as given below. Just copy the code given below and replace the two lines you found as said in STEP 5
<div class='post-body' expr:id='"post-" + data:post.id'>
<b:if cond='data:blog.pageType == "item"'>
<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 468x60, created 8/21/08 */
google_ad_slot = "4890812987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</b:if>
<div style="clear:both;/">
<p><data:post.body/></p>
<b:if cond='data:blog.pageType == "item"'>
<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 468x60, created 8/21/08 */
google_ad_slot = "4890812987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</b:if>
<div style="clear:both;/">
<p><data:post.body/></p>
NOTE : This piece of code actually checks whether the page displayed is an Item Page or not and if its is, it displays the advertisement and if not then advertisement part is not displayed. The code <b:if cond='data:blog.pageType == "item"'> does the part of checking whether this is an Item Page [individual blog post page] or not.
Replace "pub-XXXXXXXXXXXXXXX" with your Google Adsense Publisher ID.
Replace "pub-XXXXXXXXXXXXXXX" with your Google Adsense Publisher ID.
STEP 7 : Save your template and you are done. This will show a Google Ad of dimensions 468 X 60 in each posts individual page.
If you have any issues regarding this, please feel free to ask me. Let me know about your feedback and comments.
"Thank You!!! You’ve reached the end of this post. Seeing you made it this far, we hope you enjoyed this post. If so, please consider leaving a comment or subscribing to the feed to have further articles deliverd to your feed reader. You can also follow me on Twitter."
Subscribe to:
Post Comments (Atom)









