How to Display Ads Conditionally on Blogger



If you want to show your ads conditionally. For example , say you want to show the ads only on its permalink , there is a way to do that. You will be using conditional statement like the one shown below.

<b:if cond='data:blog.pageType == "item"'>




From my previous post, we learn how to put ads inside the blog post. Here we want to display the ads, only when the blog post is viewed on its permalink. You can do that by using the code below.

<b:if cond='data:blog.pageType == "item"'>


The above code test what type of page is being displayed. To use that in our previous code you will do this.

<b:if cond='data:blog.pageType == "item"'>
<div id-"adsensecode" style="float:left;">
<!--replaced this with your adsense code-->
</div>
</b:if>
<data:post.body/>

The above code will display the ads only on the permalink of the post. If you want to display the code on the homepage instead, use the code below.

<b:if cond='data:blog.pageType == "index"'>


This kind of conditional statement can also be used on widgets. If you want to display only certain widgets on your homepage you can also use these statements. But that will be taken on another post.

Comments

Mikes Sumondong said…
i will check this out and see if i can do it. sadly i'm not that techie.

Popular posts from this blog

The ImTOO iPod Computer Transfer

Choosing a Blu Ray Ripper