Tuesday, March 12, 2013

All About Blogger Conditional Tags

All about Blogger conditional Tags.In this Post we will discuss what are blogger conditional Tags and how to use them effectively according to your needs.Blogger conditional tags essential for a newbie hence I'm writing this post to make sure that you don't mess with them in the future



What are Blogger condition tags?


Blogger conditional tags usually have the <b:if cond=..> starting and an ending of </b:if>.These codes are actually the condition that we keep.We use blogger conditional tags to show certain things only in homepage.or some other things only in post pages.We can there by control where the widget or item should be visible.Lets go into further details

To display only in homepage !


If we want a widget or an item to be displayed only in homepage and not in anyother pages or post pages we use the following code.
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<p> This text is only visible in Homepage</p>
</b:if>

Displaying it anywhere except Homepage .

If you want any items/widget /adsense/code to be displayed in all pages except the homepage,we use the following code

<b:if cond='data:blog.url != data:blog.homepageUrl'>
<p>This text will be displayed everywhere except on home page</p>
</b:if>

Example of using the above code for a widget


<b:widget id='HTML1' locked='false' title='Testing Widget' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'> <!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>



To display it only on post/item pages


If you want a certain thing to be visible on on those pages where you have posted ,we use the below code

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<p>Text for post pages only</p>
</b:if>

To display it anywhere except Item/post pages 

<b:if cond='data:blog.pageType != &quot;item&quot;'>
<p>Text for everywhere except item pages</p>
</b:if>

To display on Static Page Only


To display html code only on static pages.we use the following code
<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
<p>Text for static pages only</p>
</b:if>

To display html code everywhere except static page

<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
<p>Text for everywhere except static pages</p>
</b:if>

To display only on Specific URL Only


To display only on specific post URL we use the following code
<b:if cond='data:blog.url != &quot;http://prohackertools.blogspot.com/2013/03/top-5-best-blogger-widgets-of-2013.html&quot;'>
<p>Text will display on above URL only</p>
</b:if>


To display only on Archive Pages


To display it only only on Archive Pages.

<b:if cond='data:blog.pageType == &quot;archive&quot;'>
<p>Text for Archive pages only</p>
</b:if>

To display it anywhere except the Archive pages


<b:if cond='data:blog.pageType != &quot;archive&quot;'>
<p>Text for everywhere except Archive pages</p>
</b:if>


3 comments:

  1. Awesome info..Bookmarked thesite..I learned many a thigs from here

    ReplyDelete
  2. Brother I am using iframe code below my post tilte and it affecting my blog traffic badly. is there any way to use iframe below post title without being abandoned by search engines? before you were also using adsense below post title but now you are not doing so, I think you also faced the same problem. If yes reply me please for solution.

    ReplyDelete
  3. Fantastic post! This just what I've been looking for. Thanks bro.

    ReplyDelete



Your feedback is always appreciated.It is the least thing that you can do for us !

Note:
1. Do not include links in comments as they will not be published after moderation !
2. Make sure that you click "subscribe by mail" to get notified when soemone reply to your comments.
3. Please do not spam Spam comments will be deleted immediately upon our review.

Regards,