The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. Blogger Conditional tags allows you to specify elements of your template to appear on which page or pages.

Knowing the conditional tag and using them is very important for every Blogger user. The conditional tag syntax is made up of <b:if> tag with a cond attribute added for entering the condition. For closing </b:if> tag is used.
The syntax is like this:
<b:if cond='your condition'>
CSS, HTML or Javascript Coding
</b:if>
Easy right? Let's see more...
For blogger Homepage:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
</b:if>
For index pages:
<b:if cond='data:blog.pageType == "index"'>
</b:if>
For Post pages:
<b:if cond='data:blog.pageType == "item"'>
</b:if>
For First post:
<b:if cond='data:post.isFirstPost'>
</b:if>
For Static Pages:
<b:if cond='data:blog.pageType == "static_page"'>
</b:if>
For Post and static pages:
<b:if cond='data:blog.url == data:post.url'>
</b:if>
For Archive pages:

<b:if cond='data:blog.pageType == "archive"'>
</b:if>
For Specific page/URL:
<b:if cond='data:blog.url == "your-url-here"'>
</b:if>
For Label-search pages:
<b:if cond='data:blog.searchLabel'>
</b:if>
For Error Page:

<b:if cond='data:blog.pageType == "error_page"'>
404 Error Page Coding
</b:if>
For Search Pages:
<b:if cond='data:blog.searchQuery'>
Search page Coding
</b:if>
Apply Multiple Conditions:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
If condition is true.
<b:else/>
If condition is false.
</b:if>
Reverse Condition In Conditional Tag:

<b:if cond='data:blog.pageType != "item"'>
Blog Post Page Reverse Coding
</b:if>
Hide certain DIV tag:

<b:if cond='data:blog.searchQuery'>
<style>
.content { display: none; }
</style>
</b:if>
Conditional tags can be placed everywhere in blogger template except for some exceptions that include inside widget or inside widget section. They cannot be placed inside it but can be used outside to display a specific widget on a specific page type.

Hope it helps you to understand conditional tags completely. If still you are having any problem in using conditional tags, feel free to make a comment with your problem!

Post a Comment