All Blogger Conditional Tags In Addition To How To Piece Of Employment Them

As a blogger template developer or customizer, you lot must quest to know most blogger conditional tags. By using conditional tags, you lot tin strength out specify business office of your template to specific identify nether for sure condition. Example: Using conditional tags, you lot tin strength out hide/show content on specific post/page/label/sidebar etc.

Blogger Conditional Tags

In this tutorial, i volition portion or update all blogger conditional tags together with how to piece of occupation them properly inwards your template.

1. Conditional Tag Use

First you lot quest to know how to piece of occupation them. See below example:

The conditional tags syntax start amongst <b:if> tags together with a cond attributes. Condition quest to write every bit the value of cond attribute. Every opening  <b:if> tag quest to last unopen amongst a closing </b:if> tag.

2. All Blogger Conditional Tags List

Below i convey listed all blogger conditional tags. Recently blogger released novel status tags for specific label, i likewise added this.
  1. Homepage
    <b:if cond='data:blog.url == data:blog.homepageUrl'> ADD CONTENT HERE </b:if>
  2. Blog Post/Article Page
    <b:if cond='data:blog.pageType == "item"'> ADD CONTENT HERE </b:if>
  3. Index Page
    Index pages include homepage, label page, search page together with yearly archive page.
    <b:if cond='data:blog.pageType == "index"'> ADD CONTENT HERE </b:if>
  4. Static Pages
    Static page agency blogger page which nosotros created past times blogger page section.
    <b:if cond='data:blog.pageType == "static_page"'> ADD CONTENT HERE </b:if>
  5. Post together with Static Pages
    <b:if cond='data:blog.url == data:post.url'> ADD CONTENT HERE </b:if>
  6. Label together with Search Pages
    <b:if cond='data:blog.searchLabel'> ADD CONTENT HERE </b:if>
  7. Specific Label
    Change PUT_LABEL_NAME_HERE amongst your label name. Label elevate is instance sensitive.
    <b:if cond='data:post.labels whatsoever (l => == "PUT_LABEL_NAME_HERE")'> ADD CONTENT HERE </b:if>
  8. Archive Pages
    <b:if cond='data:blog.pageType == "archive"'> ADD CONTENT HERE </b:if>
  9. Specific page/URL
    Change PUT_URL_HERE amongst whatsoever page/post/label etc url
    <b:if cond='data:blog.url == "PUT_URL_HERE"'> ADD CONTENT HERE </b:if>
  10. 404 Error Page
    <b:if cond='data:blog.pageType == "error_page"'> ADD CONTENT HERE </b:if>
  11. First Post
    This is non for a page type. It’s used for targeting the posts on multi-post pages similar (index,archive,label,search query).
    <b:if cond='data:post.isFirstPost'> ADD CONTENT HERE </b:if>

Applying Conditional Tags

To apply a conditional tag to a content, you lot quest to lay your content betwixt the opening <b:if cond..> and closing </b:if>. Example encounter below
<b:if cond='data:blog.pageType == "item"'>  CONTENT (TO BE EXECUTED IF CONDITION IS TRUE) </b:if>

The inwards a higher identify instance agency that the content volition seem alone on post pages.

Applying Multiple Conditional Tags

By putting <b:else/> tag, you lot tin strength out add together multiple condition. It agency that if get-go status non piece of occupation together with then execute minute status to all of pages. See instance below
<b:if cond='data:blog.pageType == "item"'> Content-1 EXECUTE IF TRUE <b:else/> Content-2 EXECUTE IF FALSE </b:if>

Above instance agency that execute content-1 inwards post page. If it’s non post page together with then execute content-2.

Applying Reverse Conditional Tags 

If you lot desire to contrary a conditional tag, you lot tin strength out produce it past times changing comparing operator from == (is equal to) to != (is non equal to).
<b:if cond='data:blog.pageType != "item"'>  CONTENT (TO BE EXECUTED IF CONDITION IS TRUE) </b:if>

In the instance above, the content volition seem all of pages except post page. Remember that you lot tin strength out non apply this method to Label-Search together with First Post conditionals.

Remember: You tin strength out identify all of conditional anywhere within the template HTML. It volition non piece of occupation on blogger Layout similar (Add a Gadget>HTML/Javascript)

That’s it. I holler upwards that it volition assistance you lot to customize your template every bit your wish. Happy Comment!