Hi Folks, know more about Blogger conditional Tags. In this Post we will discuss what are blogger conditional Tags and how to use them effectively according to your needs.Blogger conditional tags essential for a newbie hence I am writing this post to make sure that you don't mess with them in the future.
Blogger conditional tags usually have the <b:if cond=..> starting and an ending of </b:if>.These codes are actually the condition that we keep. We use blogger conditional tags to show certain things only in homepage or some other things only in post pages.We can there by control where the widget or item should be visible. Let’s go into further details.
If we want a widget or an item to be displayed only in homepage and not in any other pages or post pages we use the following code.
If you want any items / widgets / adsense / code to be displayed in all pages except the homepage,we use the following code
If you want a certain thing to be visible on on those pages where you have posted ,we use the below code
To display html code only on static pages.we use the following code
To display only on specific post URL we use the following code
What are Blogger condition tags?
Blogger conditional tags usually have the <b:if cond=..> starting and an ending of </b:if>.These codes are actually the condition that we keep. We use blogger conditional tags to show certain things only in homepage or some other things only in post pages.We can there by control where the widget or item should be visible. Let’s go into further details.
To display only in homepage !
If we want a widget or an item to be displayed only in homepage and not in any other pages or post pages we use the following code.
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<p> This text is only visible in Homepage</p>
</b:if>
Displaying it anywhere except Homepage
If you want any items / widgets / adsense / code to be displayed in all pages except the homepage,we use the following code
<b:if cond='data:blog.url != data:blog.homepageUrl'>
<p>This text will be displayed everywhere except on home page</p>
</b:if>
Example of using the above code for a widget
<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:include name='quickedit'/>
</b:if></b:includable>
</b:widget>
To display it only on Post / Item pages
If you want a certain thing to be visible on on those pages where you have posted ,we use the below code
<b:if cond='data:blog.pageType == "item"'>
<p>Text for post pages only</p>
</b:if>
To display it anywhere except Item / Post pages
<b:if cond='data:blog.pageType != "item"'>
<p>Text for everywhere except item pages</p>
</b:if>
To display on Static Page Only
To display html code only on static pages.we use the following code
<b:if cond='data:blog.pageType == "static_page"'>
<p>Text for static pages only</p>
</b:if>
To display html code everywhere except static page
<b:if cond='data:blog.pageType != "static_page"'>
<p>Text for everywhere except static pages</p>
</b:if>
To display only on Specific URL Only
To display only on specific post URL we use the following code
<b:if cond='data:blog.url != "http://www.digitalnavigate.in/2017/04/blog-topics-that-are-against-google.html"'>
<p>Text will display on above URL only</p>
</b:if>
To display only on Archive Pages
To display it only only on Archive Pages.<b:if cond='data:blog.pageType == "archive"'>
<p>Text for Archive pages only</p>
</b:if>
To display it anywhere except the Archive pages
<b:if cond='data:blog.pageType != "archive"'>If you like this then please subscribe to Our feeds and Like us on Facebook for Future Updates. Thank you.
<p>Text for everywhere except Archive pages</p>
</b:if>
Post a Comment