7 Blogger Page Types: Analysis, Code Snippets, Data Matrix

If you're only using the pageType tag to identify the Page Type this guide is for you. The pageType tag only identifies four of the seven Page Types. This guide will show you how to identify all seven Blogger Page Types. I know it sounds confusing, just refer to the glossary. If that still doesn't help leave comments. I understand the terminology in this document could be confusing at first.

This data was collected in part using blogger2ools.

Contents

Glossary

Page Type
The type of a page. For example, Search Page Type. This term does not always end with Type. For example, terms like Search Page and Search Page Type mean the same thing and are used interchangeably in this document.
pageType tag
Note uppercase T and no space in between page and Type. Globally available layout date tag. The pageType tag returns a value of: item, static_page, archive or index.

Item Page Type


You must have Post Pages enabled. To quote the Blogger Dashboard, Post Pages give each of your posts their own unique web page. Post Pages are called item page types because the value of the pageType tag on Post Pages is "item".

A table showing the data matrix of Blogger's item page type.

The following code snippet works only for item page types:

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


Static Page Type


Last year Blogger added the ability to publish content as stand-alone pages. Static page types are identified as "static_page" by the pageType tag.

A table showing the data matrix of Blogger's static page type.

The following code snippet works only for static page types:

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


Archive Page Type


Ideally, any link you click from the Blog Archive widget would take you to an archive page type but that's not the way it works. The pageType tag will only return a value of archive for pages whose filename ends in "archive.html". (See also What is an archive filename on Blogger Help.) Most links generated by the Blog Archive widget follow this format. The remainder use query parameters. Any page formatted that way has a pageType value of index.

This affects Blog Archive widgets using the "Hierarchy" style because some of the links it generates are search queries. In general search queries (when the URL is your homepage followed by "search?" or "search/"), return a pageType value of index.

There's a similar problem with the navigation links generated by the Blog widget on archive pages. Instead of linking to other archive pages (pages that end in "archive.html"), they link to search queries. And once again, these search queries are the index page type. Thus, any customizations you have for archive page types are lost by the next page, and your visitors will have an inconsistent experience. This problem affects all three Blog Archive widget styles. Also, the search queries themselves are malformed half the time which leads to posts getting skipped or repeated.

I haven't solved that problem yet but I've been thinking of a workaround. First, only use the "Flat List" and "Dropdown Menu" styles when configuring the Blog Archive Widget. Second, omit navigation links from Archive page types. Third, add another Blog Archive widget (that only appears on archive page types), in place of the navigation links. And finally, modify the widget so it looks like it belongs there.

A table showing the data matrix of Blogger's archive page type.

The following code snippet works only for archive page types:

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


Home Page Type


(I usually write homepage as one word but to stay consistent with this document I'm writing it as two words.) The home page is the default URL of your blog. You can find it under Setting > Publishing in the Blogger dashboard. The blog.homepageUrl global tag returns the value of your blog's home page.

A table showing the data matrix of Blogger's home page type.

The following code snippet works only for home page types:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!--Homepage-->
</b:if>


Search Page Type


The search page type displays the results of a search performed using Blogger's original built-in search form. (Not to be confused with the Search Box gadget.)

You should know that the built-in search is extremely limited: it only searches from a pool of the most recent posts, older posts are ignored and labels are ignored. In the future I might transition to the search box gadget but I'm still exploring my options.

The blog.searchQuery global tag returns the value of the search query.

A table showing the data matrix of Blogger's search page type.

The following code snippet works only for search page types:

<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--Search Page-->
</b:if>
</b:if>


Label Page Type


Label Pages are generated by the labels widget. You may only view one label at a time. There is no way to combine multiple labels for viewing, unfortunately. There is a minor bug with the labels widget which you can read more about on the Labels Widget section at blogger2ools. I've also posted a fix for it.

The blog.searchLabel global tag returns the value of the label name.

The RSS feed for a label is formatted as follows:
(home page URL)feeds/posts/default/-/(label name)

A table showing the data matrix of Blogger's label page type.

The following code snippet works only for label page types:

<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchLabel'>
<!--Label Page-->
</b:if>
</b:if>


Index Page Type


By order of elimination we are left with the index page type. As I stated back in the Archive Page Type section when a Blogger page is generated using query parameters the pageType tag returns a value of index. So basically anything that isn't one of the six previously mentioned page types we'll consider to be an index page.

A table showing the data matrix of Blogger's index page type.

The following code snippet works only for index page types:

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


Putting It All Together


The following code snippet comes directly from our own template here at MY STADY. Use this snippet as a guide for when customizing multiple or even all seven Blogger Page Types. If you're SEO-obsessed this is probably what you're looking for. We use this snippet in the header and Blog Widget portion of our template code. For other sections it's not as important to customize seven different views.

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


Closing Thoughts


First, an apology. I started drafting this blog post April 23, 2010 at 9:45PM. Everything you just read I could have told you about a year earlier. I had it all in my head! I dunno, I just found it really difficult to put all this information into words. But now that it's finally out there I feel like a huge weight has been lifted off my shoulders.

Please let me know if you find any of this confusing or if you need clarification or even if there are typos. Thank you.

65 Comments

Victor - #
June 9, 2011 at 11:46 AM
Excellent post !
Comes really handy
Kuroir - #
June 11, 2011 at 6:48 AM
Thanks bro.
K Ashwini - #
June 23, 2011 at 5:46 PM
:)
K Ashwini - #
June 23, 2011 at 5:47 PM
thank you
Gadget and electronic - #
June 26, 2011 at 7:04 PM
Amazing, I did not find any posts about Blogger Page Types as complete and comprehensive as this until I arrived at this page.
YouTube Music - #
July 10, 2011 at 2:59 PM
Very useful information, I will use this info to add videos for labels and for the search query using the Jwplayer.

Thank you very muhc for all this info about page types.
websilog - #
July 26, 2011 at 7:09 AM
this is an awesome and informative post! thanks to you, it's easier to understand the page types on blogger thus it's easier to customize it. :-)
milind - #
August 2, 2011 at 5:49 AM
Is it possible to use or-ing or and-ing with the if conditions ?
http://milindblog-hobee.blogspot.com
Alain-Christian - #
August 5, 2011 at 12:48 PM
Right now blogger doesn't have that ability. I've tried. :(

It'd make things so much easier to have && and || support.
dicoba - #
September 13, 2011 at 7:50 AM
thanks!

where i can learn looping tag blogger?
:(
Blog trikovi - #
September 16, 2011 at 5:38 PM
thank you...
cono_sur - #
October 8, 2011 at 7:56 PM
Thank you! This was really helpful!
Alain-Christian - #
October 11, 2011 at 12:44 AM
@discoba
What do you mean?

@Blog trikovi & cono_sur
My pleasure! ^__^
MS-potilas - #
November 19, 2011 at 2:20 PM
Thanks, good post. One quirk that I have noticed, data:blog.url == data:blog.homepageUrl also on post preview page, so the "front page conditionals" become true, which you might not expect, because you are viewing a post in the preview. I have not checked the pageType value in preview, but that might help to differentiate the preview from actual front page.
finder - #
November 22, 2011 at 9:19 AM
Thanks very much! It is very helpful for me.
Alain-Christian Seraphin - #
November 24, 2011 at 3:00 PM
@MS-potilas
Hmm. I don't use the new post editors so that area is a bit of a mystery. But I guess that means a blog like mine I probably wouldn't be able to properly preview the post since the front page displays everything differently.

This is definitely something you should bring up to the Blogger Developer's Group:
https://groups.google.com/forum/#!forum/bloggerdev
Yusuf Maulana - #
December 8, 2011 at 2:55 PM
you are great! we need this
Genius24 - #
December 19, 2011 at 9:47 AM
I'm gonna try thins. My problem is that my website is sowing its homepage description for every post in search result. But I want it to show the each post description. Is there any solution for this crappy problem? Thanks !
Genius24 - #
December 19, 2011 at 9:48 AM
For to mention my website url is : http://www.genius24.info/
Genius24 - #
December 19, 2011 at 9:48 AM
Alain-Christian Seraphin - #
December 19, 2011 at 10:26 PM
I'm not sure I understand the problem, Genius24.
Abdul Malik - #
February 6, 2012 at 8:49 AM
Good job man...
i think blogspot so hard to learn..but..its so helpful for me
Anonymous - #
February 10, 2012 at 11:07 PM
OMG! I was looking for this information EVERYWHERE! Thanks, glad you posted it. :-D Specifically the searchQuery one. I needed some widgets to appear on search pages, but not on all index pages, and I just KNEW there HAD to be something to be able to do that, just wasn't born knowing how, I guess *heh*. Thanks, again. :-)
Alain-Christian Seraphin - #
February 10, 2012 at 11:09 PM
My pleasure. ^__^
Fatan - #
March 3, 2012 at 11:49 AM
Thanks you so much... I did not found those code in blogger forum, So my biggest thanks is for you sir... God bless you.
iTechWhiz Technology Blog - #
March 12, 2012 at 3:25 AM
Hi Alain! you are the man...
I was looking for a possible soultion to that Search Label thingy but was almost disappointed that perhaps its not possible with blogger. But going through your snippet, i see a way to sort out this problem.
Thanks buddy!
Adnan Malik
Zahhar - #
April 11, 2012 at 4:11 AM
I found this article EXTREMELY useful. Thank you.

May $100 bills rain for a day from the sky into your backyard.

One note. I think the search functionality has improved some lately. I seem to be picking up older posts now.
GoDaddy Coupon - #
April 13, 2012 at 5:19 AM
Awesome ... thanks a lot buddy
Five On Shenton - #
June 7, 2012 at 12:07 AM
thanks
Frank - #
June 14, 2012 at 10:15 AM
Your work is just great! Thanks so much, that's what I was actually looking for: how to identify the page types and how to use their properties.
Cheers
David Kutcher - #
August 3, 2012 at 1:27 PM
Can you please update this with the page type of "error_page"?

Thank you!
Letícia - #
August 5, 2012 at 3:16 PM
thanks!
ifaniqbal.com - #
August 19, 2012 at 11:14 PM
Thanks very much.. Your post about blogger page type is very very very nice. I learn so much about that stuff from here.
atilaozer karikaturevi - #
September 1, 2012 at 5:34 PM
Hello,

Thanks for such usefull page.
I look for a code snippet such as;
It will hide all comments for all posts excluding static pages.
If possible, only comments at one static page named 'comments' can be shown.

It is possible to hide comments one by one at blogger, but number of posts are too long and it is open to make error.

Any suggestion is appreciated.
Thanks at advance
regards
Ahmad Budairi - #
October 8, 2012 at 7:09 PM
Amazing...
UnlimitSoft - #
October 11, 2012 at 4:26 AM
exellent! but a have a probl with my page navigation. thats not show, the i search something in my blog, and not show then search on label. how it?
HowToSolutionsNET - #
October 21, 2012 at 5:41 AM
Nice article

I am wondering if it is possible to get data:blog.url without query strings. I am trying to compare current page with specific URL but there is a query string in that URL that is preventing template to be saved.
Artemisia Moltabocca - #
November 20, 2012 at 1:10 AM
I'm trying to target posts that have the label blogging.
b:if cond='data:blog.searchLabel == "Blogging"'
Is this correct?
sukualam - #
December 4, 2012 at 10:04 AM
Nice article. Its helps me to edit my template.

sorry my english.
Shawn - #
February 3, 2013 at 10:39 PM
It would have been great if Blogger would have fixed the archive pageType a long time ago. I reported it hours ago and recommended for them to read the section of this post that covers the problem.

Anyways, great job on this! I've had this post bookmarked for a long time now and I hope it doesn't go anywhere.
Alain-Christian Seraphin - #
July 18, 2013 at 4:44 AM
@Shawn
Appreciate you reporting the problem, Shawn. I've done it myself a number of times but they never seem to get around to fixing it. Maybe with more people chiming in they'll listen. Yeah, keep us bookmarked, we're not going anywhere.
Alain-Christian Seraphin - #
July 18, 2013 at 11:59 AM
@UnlimitSoft
I'm..not really sure what you're trying to say there. Could you restate it? I'm sorry.
Alain-Christian Seraphin - #
July 18, 2013 at 12:15 PM
@HowToSolutionsNET

You can make comparisons but both terms have to be identical for the condition to take effect.

<b:if cond="data:blog.url == &#34;http://mystady.com/2010/01/one-piece-434-thats-so-gross.html&#34;">

That's a literal example from my current code. You can see the rest of our code on GitHub.
Alain-Christian Seraphin - #
July 18, 2013 at 12:20 PM
@Artemisia Moltabocca
Yep, that's correct! That's exactly how it looks in my code too. Remember, it's case-sensitive!
Alain-Christian Seraphin - #
July 18, 2013 at 1:40 PM
@atilaozer karikaturevi
You can easily hide comments by excluding the comment generating code for those pages. Also when editing a blog post there's the option to exclude comments. I think for what you're trying to do it'd be easier to code the blog to INCLUDE comments for only static pages.
Dea sy - #
September 30, 2013 at 5:34 AM
Thanks for information :)
Dea sy - #
September 30, 2013 at 5:34 AM
This comment has been removed by the author.
Matt Parker - #
November 5, 2013 at 5:19 AM
thank u, it helped me implement by Adsense code correctly:))
Shamatae Jackson - #
November 24, 2013 at 2:25 PM
Thank you so much! This post is completely awesome! Although I'm not really a coder, this post has helped me understand all of the Blogger customizations I've been implementing.
Shamatae - #
December 6, 2013 at 10:27 PM
Might have cracked a smile because of this post!
Ashish Singh - #
December 9, 2013 at 9:45 PM
Is there a data tag for blogger that is meant for queries like the one below:

(blogurl)/search?updated-min=2012-12-31T10:15:00-08:00&updated-max=2013-10-12T21:27:00%2B05:45&max-results=5&start=5&by-date=false
Toukir Rahman - #
January 27, 2014 at 8:54 PM
Hey thanks for the great posts ... i need a little bit of help if possible for you. i recently added a fixed top menu facebook shares and likes. now my code is working fine as i have tested it. i want to show it on item page ok that is fine its working for me. Now my problem is that i have a menu bar which is inside the body tag and not fixed. so what i am trying to do is if i go to item page the menu bar will get hidden and the share bar will be fixed and live. both are different . one is div id and one is div class now i will able to do it . Will you able to help me ...
ahmad zamroni - #
February 16, 2014 at 3:22 PM
Hi.. thanks.. nice article. if i use Page type =static page, all of my static page are selected.
But how can i write the condition, if i want to specify only to :
example.blogspot.com/p/author.html,

Zamm.
Dek Dooball - #
June 1, 2014 at 7:32 PM
thank u
Pandu Aji Wirawan - #
November 5, 2014 at 8:21 AM
Great post and clear! thank for write it :).
Sunny Mine - #
December 8, 2014 at 1:03 PM
thanks admin for sharing this knowledge, I got benefit for my Mobile Movies Site for title and related posts.
Swati singh - #
December 18, 2014 at 4:33 AM
This blog a good quality of stuff. Thanks.
free clash of clans gems
Tia - #
January 3, 2015 at 8:42 PM
This was really great. Unfortunately, it couldn't help me. I was looking for something that would let me show a snippet of code on full blog posts only but not on show it on blog pages. :/ Do you have any ideas? My blog is http://carteblanche27.blogspot.com Thank you - Tia <3
Muhamed Ali Maher - #
February 6, 2015 at 2:39 PM
thanks for this great tips
Ishtiak Ahmed - #
April 5, 2015 at 6:01 PM
I think I was just looking for it! Thank you!
تقنبات للالعاب - #
March 24, 2016 at 8:53 AM
thanks you
can you tell me if i want to write in the item page type
must i write the css or i must write html and css

example :i have header
i must write header tag and css of header
or the css only
thanks
Alain-Christian Seraphin - #
March 24, 2016 at 12:14 PM
Wat?
Siren - #
April 20, 2016 at 1:12 AM
awesome post dude. I was trying to use facebook comments onto my page, don't know where in the world the tags I should be using. This helped me greatly.
Rajat Singh - #
August 17, 2016 at 9:00 AM
Good Day I Am So Happy I Found Your Website, I
Found You By Mistake, While I Was Searching On Aol For
Something Else, Anyhow I Am Here Now And Would Just Like To Say Many Thanks For
A Remarkable Post And An All Round Entertaining Blog
I Don’t Have Time To Read It, All At The Moment But I Have BookMarked It
And Also Added In Your RSS Feeds, So When I Have Time I Will Be Back To Read More,
Please Do Keep Up The Fantastic Job. You can also check; BUGCODE_USB_DRIVER
Blogger - #
October 23, 2016 at 8:57 AM
This comment has been removed by the author.

Add a Comment