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

Train To Busan: Film Review

Train To Busan: Film Review Cast: Yoo Gong, Dong-seok Ma, Woo-sik Choi, Soo-an Kim Director: Sang-ho Yeon Despite starting off dangerously close to camp territory thanks to a resurrected road-kill, Train To Busan shakes off any silliness to provide one of the year's freshest and engaging takes on the zombie genre. In South Korea, there's a crisis - amid concerns of foot and mouth inside a quarantine zone, trouble's brewing. Thanks to a "tiny leak at a biotech district", chaos soon reigns and the region is over-run by a zombie virus, turning the masses into rabid feral biters, determined to take down anyone and anything in their way. Unaware of what's happening, Sok-Woo (Yoo Gong) is trying to get out of spending time with his estranged young daughter Soo-an (Soo-an Kim) because of work pressures. Separated from his wife in another district, Soo-an simply wants to board the train to Busan to go back to her mother, after her father failed to attend her recital....

The Magnificent Seven: Film Review

The Magnificent Seven: Film Review Cast: Denzel Washington, Chris Pratt, Ethan Hawke, Vincent D'Onofrio, Manuel Garcia-Rulfo, Martin Sensmeier, Byung-hun Lee, Peter Sarsgaard Director: Antoine Fuqua Rote and without a hint of much of his own style, The Magnificent Seven somehow manages to feel like a weaker carbon copy than a redo of the 1960s classic. This time around, Denzel Washington leads the pack as Sam Chisholm, a newly sworn warrant officer. Riding into town with nary a comment but with every head turning as a black man heads down their street, Chisholm is asked by widowed Emma Cullen (a largely underused but pleasingly effective Haley Bennett) to avenge her husband's death and free their mining town from the tyrannical grip of Bartholomew Bogue (Sarsgaard). Gathering up a motley crew of multi-racial misfits (one of the more revisionist edges that Fuqua gifts the reboot), Chisholm and his man saddle up for a fight. The Magnificent Seven is nothing in comparison to the...

The Angry Birds Movie: DVD Review

The Angry Birds Movie: DVD Review So, who remembers  Angry Birds ? That game we were all so addicted to way back when and then it suddenly died a death overtaken by consoles, Candy Crush and other such time-sucks. Well, the film version of Angry Birds doesn't care that you've abandoned it, nor does it care that it's essentially got the feel of a one-shot and gone animation, aimed squarely at throwing all its eggs in giving you a cinematic take on the game's simple MO - destroy the towers. Long story short, Jason Sudeikis is Red, the original Angry bird, who's ostracised cos of his grumpy ways (even though he's lonely from having been bullied in his younger years). Sentenced to Anger Management by a judge after erupting during a hatchday party, he meets Josh Gad's hyper-active Chuck, McBride's explosive Bomb and Sean Penn's non-verbal Terrence. But his world - and along with all those other flightless ones on his homeland of Bird Island -  is further ...