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

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 X Files: Season 10 Review

The X Files: Season 10 Review Released by 20th Century Fox Home Ent The latest season of The X Files comes 15 years after the last and represents a tour de force to those involved. If you were ever touched by David Duchovny’s laconic FBI Agent Mulder and Gillian Anderson’s cooly detached FBI Agent Scully and their yin and yang partnership as they investigated all things unusual in the 90s, the 6 new episodes would practically have made you wet yourself in glee. The hook with this season was never to dwell on the fine feeling generated by the nostalgia, but to bring a new generation of fans into the fold and to see it on its way to a new lease of life. And to a degree, it manages that by saddling the delicate balance between using the show’s alien-centric mythology and stand alone eps in this 6 part outing. While the mythology eps remain a little murky and stuffed with their own self importance, (as well as an irritatingly open final ep that lands on a frustrating cliffhanger) the sta...

HITMAN Episode 4 Bangkok Release Date

HITMAN Episode 4 Bangkok Release Date HITMAN: Episode 4 Bangkok Coming August 16 th SYDNEY, 8 TH  August 2016 -  Io-Interactive today confirms that episode 4 of HITMAN will be set in Bangkok and will be arriving on August 16 th .  The "Club 27" mission transports players to the opulence and splendour of the Himmapan luxury hotel and resort, situated on the Chao Phraya River outside Bangkok.  Your targets are rising rock star Jordan Cross, front man of trending indie band The Class, and Cross’ family lawyer, Ken Morgan.  Both are currently residing at the luxury hotel as the band finishes its highly-anticipated sophomore album. Explore the grand hotel's exquisite interiors and bask in the natural beauty of the exotic gardens adorning the hotel's exterior pavilions.  Or just enjoy the vista of the Chao Phraya River as you plan how best to carry out your mission.  “Bangkok is the exotic setting for the next episode in our HITMAN season,”  said Hannes...