About The Conditional Tags On Blogger Template

ErnasLie
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated
About The Conditional Tags On Blogger Template. Conditional tags provide us superior control over the templates, allowing us to specify what part of our template shows up only under a number of conditions.
You may wish to hide a widget or element on a single page and display it for the other, have to remove the sidebar about certain pages, or even screen buttons on pick pages. This is exactly where conditional tags be given play. There are a number of tags available pertaining to blogger which, in the event that applied correctly, will let you modify elements of your respective template.
List regarding conditional tags.

The following are a select couple of conditional tags you'll require the most:
Homepage:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
First post:
For targeting the first post on multi-post pages.
<b:if cond='data:post.isFirstPost'>
Specific page/Url:
<b:if cond='data:blog.url == "Url Here"'>
Posts (item):
<b:if cond='data:blog.pageType == "item"'>
Static pages:
<b:if cond='data:blog.pageType == "static_page"'>
Index pages (includes homepage, label pages and archive pages):
<b:if cond='data:blog.pageType == "index"'>
Archive pages:
<b:if cond='data:blog.pageType == "archive"'>
Posts and static pages:
<b:if cond='data:blog.url == data:post.url'>
Label-search pages:
<b:if cond='data:blog.searchLabel'>
404 Error Page:
<b:if cond='data:blog.pageType == "Error_Page"'>
Mobile Pages:
<b:if cond='data:blog.pageType == "data:blog.isMobile"'>

How to Use conditional tags

Blogger Conditional Tags
Blogger Conditional Tags [images source:pixabay.com]

Making use of conditional tags is easy. Each tag needs to be closed with any closing. </b:if> tag. All you should do is select the perfect tag and place this content between the opening along with the closing tag like this:
<b:if cond='The Condition Here'>
.....
</b:if>

For Example:

You need to display the content only on Index Pages (homepage, archives and labels page). The following tag will be applied:
<b:if cond='data:blog.pageType == "index"'>
...ENTER CONTENT HERE...
</b:if>

The double equals " == " actually means true. You may change the condition to false, then just replace the first equal with an exclamation sign: " != ".

Reversing a Condition:

Example:

<b:if cond='data:blog.pageType != "index"'>
... The content Goes Here ...
</b:if>

In the example above, the content will show up on all pages other than "index" pages.
The else Statement <b:else/>:
In case you need to display alternate content, insert a <b:else/> tag like this:
<b:if cond='data:blog.pageType == "index"'>
...Content 1...
<b:else/>
...Content 2...
</b:if>

Inside the example above "Sample 1" will still only appear on List Pages (homepage, microfiche and labels page), and when its not an Index Page, "Sample 2" will likely be displayed.
Combining Conditions Together:
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.url != "Url Of Post"'>
...The Sample Here...
</b:if>
</b:if>

Eventually, in the example above, the content will arrive on all posts except a clear Url/Post specified.

1 comment

  1. this site tell us how we can manage the tricks and contents Norton 360 Billing Support phone number
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.