List of All Blogspot/Blogger Conditional Tags
Sunday 20 May 2012 -
Tips And Tools
No comments
![](http://2.bp.blogspot.com/-JT3fWNy_jgM/TpEPF0wj1vI/AAAAAAAAEP8/vq7ZtgglKGw/s1600/ico_file.png)
![](http://2.bp.blogspot.com/-8N6vJXITgi4/TpEPD0ikCcI/AAAAAAAAEPs/YTFszF--q68/s1600/ico_comment.png)
![](http://1.bp.blogspot.com/-cVG5RxU6GA4/T67EIALDycI/AAAAAAAAAwg/xz2Ab3ltCz8/s110/blogger.png)
Here is list of all blogger/blogspot conditional tags that we can use for desired output. We have 6 common conditional tags which are;
- Home Page Only
- Archive Page Only
- Item Page or Post Page Only
- Static Page Only
- Specific URL Page Only
- 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 != ""'>
<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>
<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 != ""'>
<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>
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>
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 == "archive"'>
Text for Archive pages only
</b:if>
Text for Archive pages only
</b:if>
To display any widget or some statement everywhere except archive page
<b:if cond='data:blog.pageType != "archive"'>
Text for everywhere except Archive pages
</b:if>
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 == "item"'>
Text for post pages only
</b:if>
Text for post pages only
</b:if>
To display html code everywhere except item page
<b:if cond='data:blog.pageType != "item"'>
Text for everywhere except item pages
</b:if>
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 == "static_page"'>
Text for static pages only
</b:if>
Text for static pages only
</b:if>
To display html code everywhere except static page
<b:if cond='data:blog.pageType != "static_page"'>
Text for everywhere except static pages
</b:if>
Text for everywhere except static pages
</b:if>
5- Specific URL Only
To display only on specific URL
<b:if cond='data:blog.url != "http://www.funmazahome.com/p/chat.html"'>
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 == "Testing Category"'>
Text will be displayed only on Posts which have label Testing Category.
</b:if>
</b:loop>
<b:if cond='data:label.name == "Testing Category"'>
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.
0 comments:
Post a Comment