Iklan

Set the Layout of Adsense Ads Between Posts Homepage Blogspot


Set the layout of Adsense Ads Between Posts Homepage Blogspot

Set the Layout of Adsense Ads Between Posts Homepage Blogspot

Actually, to set the adsense ads between posts on the front page (homepage) blogspot is provided by Blogger. Through edit gadget blog posts in the layout (layout), we can arrange for your ad to appear in the post on the main page and how many ads were shown.

But in my opinion, to see ads in a way was sometimes disturbing to see the front page of the blog that we have procedures in such a way. And we can not set up under the posts to how ads are displayed.

Now with conditional tags like that we also can adjust the adsense ads on the front page blogspot without damaging the front page display.

Usually to regulate the form of posts on the front page either list or grid form, good background and other post will use the class post (.post). Now with class post that also we will use to place an ad so that it looks the same as the display of posts.

To display ads between posts on the main page of the blog, we'll keep it in the <b: includable id = 'main' var = 'top'> that would normally be visible or as below.

<b:includable id='main' var='top'>
  <b:if cond='!data:mobile'>
    <!-- posts -->
    <div class='blog-posts hfeed'>
      <b:include data='top' name='status-message'/>
      <data:defaultAdStart/>
      <b:loop values='data:posts' var='post'>
        <b:if cond='data:post.isDateStart and not data:post.isFirstPost'>
          &lt;/div&gt;&lt;/div&gt;
        </b:if
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-outer&quot;&gt;
        </b:if>
        <b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-posts&quot;&gt;
        </b:if>
        <div class='post-outer'>
          <b:include data='post' name='post'/>
          <b:include cond='data:blog.pageType in {&quot;static_page&quot;,&quot;item&quot;}' data='post' name='comment_picker'/>
        </div>
        <b:if cond='data:post.includeAd'>
          <b:if cond='data:post.isFirstPost'>
            <data:defaultAdEnd/>
          <b:else/>
            <data:adEnd/>
          </b:if>
          <div class='inline-ad'>
            <data:adCode/>
          </div>
          <data:adStart/>
        </b:if>
      </b:loop>
      <b:if cond='data:numPosts != 0'>
        &lt;/div&gt;&lt;/div&gt;
      </b:if>
      <data:adEnd/>
    </div>
    <!-- navigation -->
    <b:include name='nextprev'/>
    <!-- feed links -->
    <b:include name='feedLinks'/>
  <b:else/>
    <b:include name='mobile-main'/>
  </b:if>
  <b:if cond='data:top.showDummy'>
    <data:top.dummyBootstrap/>
  </b:if>
</b:includable>


To display ads, please use the code below

<b:if cond='data:blog.pageType != &quot;static_page&quot; and data:blog.pageType != &quot;item&quot;'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…!
</div>
</b:if>


1. Ads at the beginning or at the top post.

Please save the code to display their ads just below the code

<b:include data='top' name='status-message'/>


2. Advertising in the end or the bottom of posts

Please save the code to display their ads just below the code

<b:if cond='data:numPosts != 0'>
        &lt;/div&gt;&lt;/div&gt;
      </b:if>
      <data:adEnd/>


3. Advertising in between posts

To display ads between posts, please add the code index = 'x' in the code below

<b:loop values='data:posts' var='post'>

So it becomes like below

<b:loop values='data:posts' var='post' index='x'>

And please use the following code

<b:if cond='data:blog.pageType != &quot;static_page&quot; and data:blog.pageType != &quot;item&quot;'>
<b:if cond='data:x==1'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
<b:if cond='data:x==3'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
</b:if>

Number 1 means that the ads displayed under the posts, and the number 3 means the ad is displayed under the four posts. So please adjust these figures to set the ads between posts.

Then save the code right below the following code

<div class='post-outer'>
          <b:include data='post' name='post'/>
          <b:include cond='data:blog.pageType in {&quot;static_page&quot;,&quot;item&quot;}' data='post' name='comment_picker'/>
        </div>

And add this CSS to set the word "Advertisement ", if not quite fit please adjust.

.post span.title-ads{font-size:16px;font-weight:bold;display:block;margin:10px 0}

So the complete appearance will be as below

<b:includable id='main' var='top'>
  <b:if cond='!data:mobile'>
    <!-- posts -->
    <div class='blog-posts hfeed'>
      <b:include data='top' name='status-message'/>
<b:if cond='data:blog.pageType != &quot;static_page&quot; and data:blog.pageType != &quot;item&quot;'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
      <data:defaultAdStart/>
      <b:loop values='data:posts' var='post' index='x'>
        <b:if cond='data:post.isDateStart and not data:post.isFirstPost'>
          &lt;/div&gt;&lt;/div&gt;
        </b:if>
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-outer&quot;&gt;
        </b:if>
        <b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-posts&quot;&gt;
        </b:if>
        <div class='post-outer'>
          <b:include data='post' name='post'/>
          <b:include cond='data:blog.pageType in {&quot;static_page&quot;,&quot;item&quot;}' data='post' name='comment_picker'/>
        </div>
<b:if cond='data:blog.pageType != &quot;static_page&quot; and data:blog.pageType != &quot;item&quot;'>
<b:if cond='data:x==1'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
<b:if cond='data:x==9'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
</b:if>
        <b:if cond='data:post.includeAd'>
          <b:if cond='data:post.isFirstPost'>
            <data:defaultAdEnd/>
          <b:else/>
            <data:adEnd/>
          </b:if>
          <div class='inline-ad'>
            <data:adCode/>
          </div>
          <data:adStart/>
        </b:if>
      </b:loop>
      <b:if cond='data:numPosts != 0'>
        &lt;/div&gt;&lt;/div&gt;
      </b:if>
      <data:adEnd/>
<b:if cond='data:blog.pageType != &quot;static_page&quot; and data:blog.pageType != &quot;item&quot;'>
<div class='post'>
<span class='title-ads'>Advertisement</span>
ADS code here…
</div>
</b:if>
    </div>
    <!-- navigation -->
    <b:include name='nextprev'/>
    <!-- feed links -->
    <b:include name='feedLinks'/>
  <b:else/>
    <b:include name='mobile-main'/>
  </b:if>
  <b:if cond='data:top.showDummy'>
    <data:top.dummyBootstrap/>
  </b:if>
</b:includable>

May be useful…

Next
Prev Post
Previous
Next Post

1 comment: