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 responsive mode.

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

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

code conditional tag blogger

List of Contional 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 == &quot;index&quot;'>
</b:if>
Or
<b:if cond='data:blog.pageType != &quot;item&quot;'>
</b:if>

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


3. Post Page (Single Post)

a. Display widget only in single page/single post
<b:if cond='data:blog.pageType == &quot;item&quot;'>
</b:if>
Or
<b:if cond='data:blog.pageType == &quot;index&quot;'>
</b:if>

b. Display widget except in single page/single post
<b:if cond='data:blog.pageType != &quot;item&quot;'>
</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 != &quot;static_page&quot;'>
</b:if>


5. Archive Page

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

b. Display widget except in archive page
<b:if cond='data:blog.pageType != &quot;archive&quot;'>
</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 == &quot;error_page&quot;'>
</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 / HTML CODE HERE --->
</b:if>


Want to see an example?? You can see it in Main-Blogger.com. Just click on homepage, label pages, or single post. Dont forget responsive mode too :p

No comments:

Post a Comment