If Statements in Blogger

The Blogger template may be limited in what it can do, but one great benefit it offers is the use of if statements. Blogger has their own special “if” HTML tag. What are they good for? Well, I often get questions such as, how do I get such and such to only appear on the home page or not appear on the home page? Those if HTML tags will help us accomplish that. Now I’m NOT going to step you through where you need to go to place these if statements, because everyone has a different kind of template and that would take too long. Instead, I’ll show you the different kinds of if HTML tags and explain how to use them.

Item Page

The first type of page is the item page. You’ll know this as each of your individual blog posts. These are only your posts not your pages. The “if” HTML tag is pretty easy to understand. It just says that if the condition “blog page type is equal to an item page” THEN execute the following HTML. So this tag:

would go at the beginning of the HTML section that you want to only appear on individual blog posts. Then this tag:

would go at the end of that section of HTML. The “if” tags wrap around the HTML section that you want to only appear on blog posts.

Static Page

Now the static pages are your “Pages” in Blogger (ie your contact, about me, reviews…). Follow the same steps as the item page above and put this tag at the beginning of your HTML section:

and this tag at the end:

Home Page

HTML appears only on your home page:

Mobile Screen

HTML appears only on the mobile version of your site:

Using these tags takes a more advanced knowledge of how to navigate a Blogger template, so if you don’t feel comfortable doing that, this may not be the tutorial for you.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

8 thoughts on “If Statements in Blogger

  1. I used this a while ago to get a contact form on only one page, but my coding was rather clumsy and all over the place so thanks so much for posting this!!