2011-01-15

Blogger: show ads inside posts (not between)

This post explains how to show Google’s Adsense ads directly after the content of each post, before the comments. Currently, one can only show them after a complete post, which means that they will be pushed back to the very end on single-post pages.

Step 1: Enable ads between posts.

  • Go to “Design → Page Elements” and edit “Blog Posts”. There, you have to enable “Show Ads Between Posts”.
    • Check out how your blog looks now. If you are already happy with it, you are done.
    • Note, though, that ads will appear after all comments when single posts are shown. This might not be what you want.
  • Google will show at most 3 ads on each page which includes ads in the sidebars. Thus, if you have 3 ads in the sidebars, none will ever appear between posts.
Step 2: Change the location of the ads.
  • Go to “Design → Edit HTML”.
  • Under “Edit Template” you have to “Expand Widget Templates”.
  • Show ads inside posts: Search for the following text and insert the code between the comments (you can include the comments themselves or not, it doesn’t matter).
        <b:if cond='data:post.hasJumpLink'>
        ...
        </b:if>
    
        <!-- begin: custom -->
        <b:if cond='data:post.includeAd'>
              &lt;br&gt;
            <data:adEnd/>
            <data:adCode/>
            <data:adStart/>
        </b:if>
        <!-- end: custom -->
        
        <div class='post-footer'>
    
    Explanation: the “br” tag after the “if” condition adds extra spacing. It must have its entities escaped (&amp; etc.), because the meta-language is XML and HTML is only embedded inside. Thus, if you are not using XML as HTML macros, you must escape verbatim HTML.
  • Prevent ads from appearing between posts: Add comments (<!-- and -->, printed in bold below) before and after the following if element.
    <!--
        <b:if cond='data:post.includeAd'>
        ...
        </b:if>
    -->
        <b:if cond='data:post.trackLatency'>
    
Related post:
  1. Tips for Google Blogger: avoiding lock-in and more

11 comments:

GamesundGadgets said...

Wow thanks a lot, worked fine for me on my blog: http://gamesundgadgets.blogspot.com/

Just Been Paid said...

Hey it worked! Thanks!

tech said...

really informative....... thnx a lot
its working gr8 for my blog...http://betechupdated.blogspot.com

Anti-Researcher said...

What if you have adsense from another brand and not google?

Infocera said...

Extremely simple and much worth hack on blogger for increasing earning...thnx a ton

SpideRaY said...

Will this work with parsed google ads codes that include the custom channel as well ?  Like on their post @ www.mydigitallife.info/place-adsense-ad-unit-in-various-positions-inside-within-blogger-post-contents/comment-page-1/

Kamran Zia said...

Thank you for the post it worked for my blog too www.archivedsoftwares.blogspot.com

Bilal Akbar said...

When i click on show ads between posts this does not works. can you please reply me here bilalakbar2344@yahoo.com

Rocky said...

Hey...nice work...u should download cool stuff on Free Blogger widgets Download, highly compressed games, movies download Thnxxxxx

Rocky said...

fukatchands.blogspot.in

Neeraj Kumar said...

can you tell me problem with this url,why ad is causing gap with respect to picture

http://technocrazepro.blogspot.in/2013/01/How-to-See-Who-Is-Online-On-Facebook-While-Remaining-Offline.html

Web Analytics