Skip to main content

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

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:)

Comments

Popular posts from this blog

Strange problem occured while trying to create a CSV file using PHP Script - The file is not seen on FTP but can download using file's absolute path url

Strange problem occured while trying to create a CSV file - The file is not seen on FTP but can download using file's absolute path url Last day I came across a strange problem when I tried to create a csv file on therver using a PHP script. the script was simply writing a given content as a csv file. The file will be created runtime. What happened was, The script executed fine, file handler for new file was created and contents was wrote into the file using fwrite and it returned the number of bytes that was written.

How to get the Query string of a URL using the Javascript (JS)?

JS function get the Query string of a URL or value of each parameter using the Javascript(JS)? If you want to get your current page's url var my_url=document.location; to get the query string part of the url use like this: var my_qry_str= location.search; this will return the part of the url starting from "?" following by query string Lets assume that your current page url is http://www.crozoom.com/2013/page.html?qry1=A&qry2=B then the location.search function will return " ?qry1=A&qry2=B " to exclue "?", do like this:


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 »
Member
Search This Blog