These statements, while useful weren't very easy to implement and manage on a large blog. Tracking different conditional statements can get tedious. Luckily, Blogger now has a better solution.
Instead of conditional statements, now we have conditional tags, and content enclosed within these tags is displayed based on the nature of the tag. Here are the different types of tags available;
- <MainPage> </MainPage>
- <ArchivePage> </ArchivePage>
- <ItemPage> </ItemPage>
- <MainOrArchivePage> </MainOrArchivePage>
If you have something in your template that you only want to appear on the main page of your blog, simply put and tags around it, and similarly for the other page types.
Conditional tags: example
Suppose you want to modify all your post pages to include a link back to the main page of your blog. That way, if someone arrives at an individual post from a search or an outside link, they'll be able to easily click over to your main page to read your current posts. To do this, just add this code to your template, wherever you'd like it to appear:
<ItemPage><a href="http://example.blogspot.com">Read my latest posts!</a></ItemPage>
Because you've wrapped this particular bit of HTML in the <ItemPage> </ItemPage> conditional tags, the only condition under which this link will show up is when someone is visiting one of your individual post pages. The link will not show up on your main page.
The advantage of this new approach is, you can easily keep track of all the items you want to display on a particular page. For example, all the homepage widgets can be kept within the <MainPage> tag.
The power may be limited for now to only four types of pages, but Blogger is working on this new approach, and soon many more tags will follow, giving you more power over your Blogger template. Meanwhile, if you have any questions, please feel free to ask us in the comments section below. Cheers :)