Blogger Conditional Tags: Make your Blog Dynamic

The XHTML of the Blogger blog lets us edit the Template and make it Dynamic. We have already seen the different pagetypes that blogger has and the various conditional tags that could be used with it accordingly in those pages in this post - 7 Blogger Pagetypes: The Most Used Conditional Tags.


We'll now check out some additional conditional tags.

1. Waiting to implement a functionality only in the Homepage?
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!--Homepage-->
</b:if>

2. Want to add buttons only in the Post pages & Static pages?
<b:if cond='data:blog.url == data:post.url'>
<!--Post and Static Pages->
</b:if>

3. Ready to do specific change only in one specific post/page?
<b:if cond='data:blog.url == "URL"'>
<!--Specific Page-->
</b:if>

4. Wish to have a job done in all-pages except post-listing-pages?
<b:if cond='data:blog.pageType != &quot;index&quot;'>
  <!-- all pages NOT index pages -->
</b:if>

5. Do you have any multi-conditional function to do?
    No problem. Blogger has its own special <b:if> and <b:else/> tags.
<b:if cond='CONDITION-CODE-1'>
<!--..Action-Code-1...-->
<b:elseif cond='CONDITION-CODE-2'/>
<!--..Action-Code-2...-->
<b:else/>
<!--..Default-Action-Code...-->
</b:if>

6. Would you like to perform AND/OR operations anywhere?
    Solution is here. Blogger makes use of AND/OR operators in the conditional tags.
<b: if  cond='CONDITION-CODE-1 && CONDITION-CODE-2'>
<!--..Action-Code...-->
</b: if >
<b: if  cond='CONDITION-CODE-1 || CONDITION-CODE-2'>
<!--..Action-Code...-->
</b: if >