Hello guys welcome to solution host.

Today I am going to show you blogger conditional tags.

I know that you want to develope your own theme in blogger. So this article for you. Because blogger conditional tags is used so many times in theme for different different purposes.

Blogger Conditional Tags

Read complete article and know all conditional tags of blogger.

So let's start it.

Blogger conditional tags

Blogger conditional tags are those tags which are used for show elements according to conditions.

We use blogger conditional statements for give some conditions and perform some operations in blogger template.

Why use blogger conditional tags

Blogger conditional tags are very important and useful for create a blogger template.

If you want understand that, what are the uses of blogger conditional tags, then you can understand it by below example -

Assume that you are making blogger template. When you are making homepage of website (means hero section, features sections etc) then you need to show the it only homepage.

If you are making the homepage design without blogger conditional tags then your homepage sections like hero section, features section will showing on all post page and all pages (labels, archive, search etc).

But it is not good. Because the elements of homepage must should be show only on homepage.

So for show homepage design in only Homepage you need to hide the homepage design from another pages.

For this purpose we use blogger conditional tags.

How to write conditional tags in blogger

For give conditional statements in blogger you need to know it's syntax.

So let's see syntax of blogger conditional tags


<b:if cond='any condition'>
Some elements or codes
</b:if>

In above syntax, you can see how to write the blogger conditional statements.

For blogger conditional statements we use two tags and one cond attribute to give condition.

  • <b:if> tag
  • <b:else> tag

Cond attribute

We give the conditions inside cond attribute.

Example of blogger conditional statements -

<b:if cond='data:view.isHomepage'>
<h1>I will show only on homepage</h1>
</b:if>

In above example we use <b:if> tag and we gives the condition by using cond attribute, for show elements only on homepage.

The heading tag is written inside <b:if> tag will be show only homepage but will not display on another page. Because condition is for only homepage.

Types of blogger conditional tags

There are lots of conditional tags in blogger.

Following is the most important blogger conditional tags -

  • <b:if cond='data:view.isHomepage'>
  • <b:if cond='data:view.isPost'>
  • <b:if cond='data:view.isPage'>
  • <b:if cond='data:view.isLayoutMode'>
  • <b:if cond='data:view.isLabelSearch'>
  • <b:if cond='data:view.isArchive'>
  • <b:if cond='data:view.isSingleItem'>

So above is the most important conditional tags of blogger.

Conclusion

In this article you have learn blogger conditional tags.

In next article we will learn each conditional tags with details.

Thanks for reading.