Tuesday, 18 August 2015

Controlling Widget/Adsense Placement Using Conditional Tags in Blogger Blog

Are you wondering how widgets or Google Adsense placed on some bloggers blog are meant to appear only on static pages, homepage, archive page, main page and or item page? these are the works of conditional tags. with conditional tags, you can restrict adsense placement on individual post only or for some ads to show on your main page while it hides away from the content or individual pages. with this tag you can give conditions to any widget where to appear and not to. through this post i will show you how to use these conditional tags to position your widgets (Google ads) in strategic places.

What are Conditional tags
This are tags used on blogger templates that allows greater flexibility in templates designs. they are called conditional tags because they allow you to specify where and how you want your widgets/adsense to show on your blog

Displaying widget only on Homepage
If you want to display your widgets on homepage only, then use this tag


<b:if cond='data:blog.url == data:blog.homepageUrl'>
</b:if>
How to use it
Enter your widget/adsense code between the codes thus

<b:if cond='data:blog.url == data:blog.homepageUrl'>
ENTER CODES HERE 
</b:if>

Display widget on post pages only
The following codes will make your widget appear on post/item pages only


<b:if cond='data:blog.pageType == &quot;item&quot;'>
</b:if>
The post page refers to the individual post. this is the page when you click the title of the post or the read more link in Blogger to read the full post.  

How to use it
Enter your widget/adsense code in between the codes thus
<b:if cond='data:blog.pageType == &quot;item&quot;'>
ENTER CODE HERE
</b:if>

You can also use this conditional tag to display ad link on post page otherwise to display ad unit for every other pages. using this tag

<b:if cond='data:blog.pageType == &quot;item&quot;'>
ENTER AD LINK CODE HERE
<b:else/>
ENTER AD UNIT CODE HERE
</b:if>

Display widget on specific page only
This conditional tag will show widget on a particular page selected

<b:if cond='data:blog.url == &quot;URL of the page&quot;'>
</b:if>

How to use it
Enter your widget in between the codes and replace the URL of the page to the particular page URL in question thus

<b:if cond='data:blog.url == &quot;http://yourpageurl.com&quot;'>
ENTER CODE HERE
</b:if>

Display widget on Index page
Index page refers to every other page except item (post) pages. This conditional tag will show widget on all pages except post/item page.

<b:if cond='data:blog.pageType == &quot;index&quot;'>
ENTER CODE HERE
</b:if>

Display widget on Archive page only
This tag is for your archive pages in Blogger.

<b:if cond='data:blog.pageType == &quot;archive&quot;'>
ENTER CODE HERE
</b:if>

Displaying widget on static page
The following tag will show widgets on static pages only in Blogger:

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
ENTER CODE HERE
</b:if>

Displaying widget On Specific Label Page Only With this method you can display any widget on any specific label page. For example you may have posts on Free ebooks and when the label books is clicked in your blog the sidebar will show a widget which you have added specially for your Free ebooks.
For this we will use the following code:
<b:if cond='data:blog.url == "http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME"'>
</b:if>

How to use it
Just copy your blog label url link and and replace it with http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME

So I think now you all know the use of Conditional Tags and It’s Implementation.Well if you have any problem then feel free to use the comment box.

I hope this info helps? feel free to share this post with your friends using the like/share buttons. you can also subscribe to my blog below this post for more tips delivered to your inbox. or simply ask any question by using the comment box below. subscribe and never miss any future post through this link CLICK HERE TO SUBSCRIBE Once entered, you will have to check your inbox for a confirmation email containing a confirmation link. Once you VERIFY your email by clicking on the confirmation link in the message, you will never miss any future articles again.


No comments:

Post a Comment