Type And Functions Conditional Tag Code Blogger

Conditional tag code Blogger have a different type and function. New design of Main-Blogger.com itself also optimized by conditional tag code for homepage, label post page, single post, and also mobile views.Type And Functions Conditional Tag Code Blogger template

Conditional tag allow you to define section or widget of your template appear or not displayed in specific page/pages of your blog. Basically, the syntax is like this

Blogger already released new Conditional tag codes.

<b:if cond='CONDITIONAL_TAG_HERE'>
<--- YOUR CSS, SCRIPT, OR HTML CODE HERE --->
</b:if>

List of Conditional Tag

1. Home Page

a. Display widget only in Homepage
<b:if cond='data:blog.url == data:blog.homepageUrl'>
</b:if>

b. Display widget except in Homepage
<b:if cond='data:blog.url != data:blog.homepageUrl'>
</b:if>


2. Index Post

a. Display widget only in homepage, labels page and yearly archive page.
<b:if cond='data:blog.pageType == "index"'>
</b:if>

b. Display widget except in homepage, labels page and yearly archive page.
<b:if cond='data:blog.pageType != "index"'>
</b:if>

3. Post Page (Single Post)

a. Display widget only in single page/single post
<b:if cond='data:blog.pageType == "item"'>
</b:if>

b. Display widget except in single page/single post
<b:if cond='data:blog.pageType != "item"'>
</b:if>

4. Static Page

a. Display widget only in static page
<b:if cond='data:blog.pageType == "static_page"'>
</b:if>

b. Display widget except in static page
<b:if cond='data:blog.pageType != "static_page"'>
</b:if>

5. Archive Page

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

6. Specific page/URL

a. Display widget only in specific pages.
<b:if cond='data:blog.url == "URL_SPECIFIC_PAGE"'>
</b:if>

b. Display widget except in specific pages.
<b:if cond='data:blog.url != "URL_SPECIFIC_PAGE"'>
</b:if>

7. Label Search Pages

<b:if cond='data:blog.searchLabel'>
</b:if>

8. Link Error Pages

This code for 404 page
<b:if cond='data:blog.pageType == "error_page"'>
</b:if>

9. Post and static pages

<b:if cond='data:blog.url == data:post.url'>
</b:if>

10. Mobile View

This code only for Mobile view
<b:if cond='data:blog.isMobile'>
</b:if>

11. First Post

This code only for the first post. Use this code to make a different post style for first post
<b:if cond='data:post.isFirstPost'>
</b:if>

How to Use Conditional Tag?

We can use a conditional tag like this
<b:if cond='CONDITIONAL_TAG_HERE'>
<--- YOUR CSS, SCRIPT, OR HTML CODE HERE --->
</b:if>
 
Post a Comment