Wednesday, December 16, 2009

How To Put AdSense Code in Post Body-Blogger

One of the Best Place to put adsense code is between the post title and Body. For doing  so in blogger we need to put code direcly in the XML template.

First Locate the following code by taking "Layout-Edit HTML"

<data:post.body/>
 other lines between that code will be like this

 <div class='post-header-line-1'/>
    <div class='post-body'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
  </div>

 Now Select your Adsense code from Adsense account like 250*250  and FORMAT it. Check this post for formatting

 add ths formatted adsense code inside an HTMl Div element
<div style='float:left;'>
AdSense Code
</div> 

Insert this Code here

 <div class='post-header-line-1'/>
    <div style='float:left;'>
    AdSense Code
    </div>

<div class='post-body'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
  </div>

Save Template and Check the post.You Can See the Adsense Floating to the left of the body. See the Screen Shot below















If you need to Place adsense to the right of the text Place this Code instead
 <div class='post-header-line-1'/>
  <div style='float:right;'>
   AdSense Code
 </div>
<div class='post-body'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
  </div>



If User needs to put adsense code only in blogger First Post Use the following code instead

<div class='post-header-line-1'/>
<b:if cond='data:post.isFirstPost'>
    <div style='float:right;'>
    AdSense Code
    </div>
</b:if>
<div class='post-body'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
  </div>


Even if the User used the "Read More" link in any post in the blogger, he will see the adsense Code when he opens the link since now the first post in the page will be that  "Read More" post.

2 comments:

Nguyễn Đạt Tài said...

nice templates

Andy said...

I really could do with this. I am sure it is a great way of increasing income. However do you have a YouTube clip showing how simple? it really is. Keep up the excellent work
http://pattayabound.blogspot.com

Post a Comment