Breaking News
Loading...

List of All Blogspot/Blogger Conditional Tags

1:13 AM

Conditional tags are part of blogspot's XML language which allow you to display certain parts of your template under certain conditions. These tags are just like conditional tags of any other language i.e. if, else etc. These conditional tags can be used to control appearance of widgets or part of your blog design. .

Here is list of all blogger/blogspot conditional tags that we can use for desired output. We have 6 common conditional tags which are;

  1. Home Page Only
  2. Archive Page Only
  3. Item Page or Post Page Only
  4. Static Page Only
  5. Specific URL Page Only
  6. Certain Labels Only
If you want to display a widget using above conditional tags, you will have to replace the BLUE bold line code with desired conditional tag. Conditional tags are explained below this code.

<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:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>

1- Home Page Only

To display any widget or part of template on Home Page only, we use this conditional tag;

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

And to display it everywhere except homepage we use;

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

2- Archive Page Only

If you want to display any widget or some statement on Archive pages; you can use this conditional tag.

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

To display any widget or some statement everywhere except archive page

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

3- Item/Post Page Only

To display html code only on item page

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

To display html code everywhere except item page

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

4- Static Page Only

To display html code only on static pages

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

To display html code everywhere except static page

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


5- Specific URL Only

To display only on specific URL

<b:if cond='data:blog.url != &quot;http://www.folsol.com/p/chat.html&quot;'>
Text will display on above URL only
</b:if>

6- Certain Labels Only

To display content on certain labels/categories only:

<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;Testing Category&quot;'>
Text will be displayed only on Posts which have label Testing Category.
</b:if>
</b:loop>

If you face any trouble applying any conditional tag; do let me know via comments.
 
Toggle Footer