Skip to main content
Commercial Photography

Conditional Tags for your blogger to make more responsive

Conditional Tags for your blogger to make more responsive

There are a few tricks to hide elements of both the blog on the home page / homepage, posts, static pages or by adding a conditional tag code in each element you want to hide.

Example
<b:if cond='data:blog.pageType != "static_page"'>
..... The contents of the content to be wrapped conditional tags (Content will be hidden in the static pages) .....
</b:if>

Not only hides an element but it could be to display only certain elements in the page that you specify.

Example
<b:if cond='data:blog.url == data:blog.homepageUrl'>
..... The contents of the content to be wrapped in the conditional tag (content will only appear on the home page) .....
</b:if>
for more details please refer to some function conditional tag for widget below: 


1. Widget displays only on the home page:


<b:widget id='HTML1' locked='false' title='Recent Posts' 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

2. View the Widgets only on the post page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

3. View the Widgets only on certain page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == "Your URL"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>
Change "Your URL" to your page url.

4. Hiding the Widgets only on certain page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url != "Your URL"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>
Change "Your URL" to your page url.

5. Display Widgets only on a static page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "static_page"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

6. Hide Widgets on a static page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType != "static_page"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

7. Widgets display only on the archive page:


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "archive"'>
<!-- 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:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>

Once you add a tag conditional upon, save the template and see the results. Not limited to the widget, with conditional tags you can wrap other elements such as scripts, CSS, or HTML template for reasons accelerate blog by reducing the script contained in a page or other privacy reasons. May be useful.

Comments

Popular posts from this blog

New Fifty Shades Darker poster drops

New Fifty Shades Darker poster drops The brand new poster for Fifty Shades Darker , starring Jamie Dornan and Dakota Johnson has just dropped. It comes ahead of the new New Fifty Shades Darker trailer release tomorrow.

Savdhaan India Ep1591 19 Apr 2016 Lust Leads To Crime

Savdhaan India Ep1591 19 Apr 2016 Lust Leads To Crime Telecast Date: 19.Apr.2016 Running Time: 00:41:51 Language: Hindi Story: Read more »

Big F S01 Ep002 18 Oct 2015 Love just happens

Big F S01 Ep 0 02 1 8 Oct 2015 Love just happens Language:  Hindi Story: Read more »