Home  »     »     »     »  How to check Page Types in blogger templates for customizing blog pages

How to check Page Types in blogger templates for customizing blog pages

Tuesday, October 22, 2013

Blogger users come across situations like customising their Blog templates for adding various plugins or custom changes. So for doing this, they should be aware of various page types and how to identify that using blogger specific conditional statements.

various types of blogspot pages are Item, Statis, Index, Archive, Search Label etc

to get the page type you have to use the parameter "data:blog.pageType"


How to check an Archive type Page?

Here the "data:blog.pageType" will be "archive"

do it like this:

<b:if cond='data:blog.pageType == "archive"'>
<!--Archive Page-->
</b:if>

How to check index page?

Search page, label page and home page of the blog comes under "index" type

So here is how it is checked:

<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--Search Page-->
</b:if>
<b:if cond='data:blog.searchLabel'>
<!--Label Page-->
</b:if>
<b:if cond='data:blog.searchQuery == ""'>
<b:if cond='data:blog.searchLabel == ""'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!--Homepage-->
<b:else/>
<!--Index Page-->
</b:if>
</b:if>
</b:if>
</b:if>



How to Check the Item page?

Item page means the detailed posting page. This is the page that you view after clicking on a "Continue reading" or "read more" link on home/label/search page

Item page is check like this:

<b:if cond='data:blog.pageType == "item"'>
<!--Item Page-->
</b:if>


How to check a static type Page?
Static pages are stand alone pages, like sitemap, contact us page etc you can check it using follow statement

<b:if cond='data:blog.pageType == "static_page"'>
<!--Static Page-->
</b:if>


Consolidated Page type checking code for blogger templates
Given below is the Consolidated Page type checking code

<b:if cond='data:blog.pageType == "archive"'>
<!--Archive Page-->
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--Search Page-->
</b:if>
<b:if cond='data:blog.searchLabel'>
<!--Label Page-->
</b:if>
<b:if cond='data:blog.searchQuery == ""'>
<b:if cond='data:blog.searchLabel == ""'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!--Homepage-->
<b:else/>
<!--Index Page-->
</b:if>
</b:if>
</b:if>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<!--Item Page-->
</b:if>
<b:if cond='data:blog.pageType == "static_page"'>
<!--Static Page-->
</b:if>


Above given steps will be helpful for those why try to implement changes in templates, like adding Adsense codes seperately in various pages and lots more funny things :)

Hope this helps:)



How to link to this page?
If you wish to link to this page from your website, simply Copy and paste the above HTML code to your web page. It will appear on your page as:
How to check Page Types in blogger templates for customizing blog pages.




Share this!




comments powered by Disqus

This Weeks 7 Popular Posts


Subscribe to Recent Posts by Email
Stay connected to CROZOOM with regular Email notices of new Techie articles and IT Jobs. Updates will be delivered to your Inbox as soon as they are posted online.

Enter Your Email Address:  

Delivered by FeedBurner   RSS Feed

Search this Blog   



Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »