Understanding If Conditional Tags For Blogger

If conditional statements are very important part of any programming language. It is used to determine certain logic based on a given condition. Similarly, Blogger blogs too have HTML if conditions which are specific to only Blogger HTML templates/codes. The if conditions which we are going to learn today are highly specific to Blogger HTML standards and these codes work only with Blogger templates.

We have already seen how to use conditional tags to make the gadgets appear on post page, home page and so on.

If conditional tags are important because, you can easily control the Blogger template elements.

We will see the supported if conditional statements for Blogger now:

Two types of if statements:
1. Type 1
<if condition >
Some text
<if ends>

2. Type 2
<if condition>
Some statements
<else>
Some statements
<if ends>

Eg: http://www.itechcolumn.com or http://yourblogname.blogspot.com

<b:if cond='data:blog.url == data:blog.homepageUrl'>
TEXT/IMAGE/GADGET/CODE
</b:if>

2. For Static Page(Stand-alone Pages)
Eg: http://www.itechcolumn.com/p/itechcolumn-table-of-contents.html

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
TEXT/IMAGE/GADGET/CODE
</b:if>
3. For Post Page(Link to the full post page)
Eg: http://www.itechcolumn.com/?p=141

<b:if cond='data:blog.pageType == &quot;item&quot;'>
TEXT/IMAGE/GADGET/CODE
</b:if>


<b:if cond='data:blog.pageType == &quot;archive&quot;'>
TEXT/IMAGE/GADGET/CODE
</b:if>
This conditional tag is used every other pages expect the post pages. <b:if cond='data:blog.pageType == &quot;TEXT/IMAGE/GADGET/CODE</b:if>

TEXT/IMAGE/GADGET/CODE</b:if>

TO USE ELSE CONDITION AS:
Eg:

<b:if cond='data:blog.pageType == &quot;URL_OF_THE_PAGE&quot;'>
TEXT/IMAGE/GADGET/CODE
</b:else>
SOME TEXT/IMAGE/GADGET/CODE </b:if> 

ALTER THE IF CONDITON USING != AS:
Eg:

<b:if cond='data:blog.pageType != &quot;URL_OF_THE_PAGE&quot;'>
TEXT/IMAGE/GADGET/CODE </b:if>