Blogger: Please Expand The pageType Attribute

blogger2ools logoIMPORTANT UPDATE: This post is outdated! I've since found a way to accomplish every issue I raised in this post. I've also shared my findings. You can start by reading Make Printer Friendly Versions of Your Blogger Posts Without Hacking and 7 Blogger Page Types: Analysis, Code Snippets, Data Matrix. Other posts of interest you will find filed under Blogger.


I humbly propose that the Blogger pageType attribute be expanded to include label, print, homepage, search and all values. Right now it only supports item, archive and index values. I also propose that pageType be brought back as an attribute of the WIDGET tag.

Accepted Values For pageType

  • archive: The user is browsing through past entries.
  • index: The user is on the homepage or browsing through search results.
  • item: Individual blog posts.

Using values other than the above will result in the page element not being displayed.


Possibly Depreciated Values

  • all: Page element will not be displayed.
  • main: Same as above

The two values above are referenced in Blogger Help under Page Elements Tags for Layouts. This page is clearly out of date (e.g., it lists pageType as an attribute of the WIDGET tag but in reality the pageType attribute is stripped from the WIDGET tag when saving your layout).


label pageType Value Proposal


Right now when you click on a label it runs a search query in the form of http://BLOGDOMAIN/search/label/LABELNAME and displays the results 20 posts at a time. There sort of exists code to check if the user is browsing this page:


<b:if cond='data:blog.url == data:label.url'>


That code only works within the confines of the Blog and Label widget types, thus limiting it's usefulness. It works as expected for the first page of results; however, when the user goes to the next page it stops working because the URL no longer matches with http://BLOGDOMAIN/search/label/LABELNAME.

A proper label value would fix the bug above with the bonus of being able to check for it from any widget type. This could really open up a whole new world of functionality.


print pageType Value Proposal


A print value would allow us the ability to transform the page and make it more presentable for printing. It would be up to template designers to take advantage of this value. A suggestion would be to have the print value function similarly to the old-style comments page. The difference would be that designers still have control over what happens on that other page—unlike the old style comments.


homepage Value And pageType Attribute For WIDGET Tag Proposal


Right now if I want something to appear only on the home page I use some variation of the code below (emphasis on 4th line):

<!-- SmoothGallery v2.0 --><b:widget id='HTML1' locked='true' title='SmoothGallery v2.0' type='HTML'><b:includable id='main'><b:if cond='data:blog.url == data:blog.homepageUrl'><div class='widget-content'><data:content/></div></b:if></b:includable></b:widget>

The result is a widget that only displays on the home page; however, when you examine the source from anywhere outside the home page you see this:

<div class="widget HTML" id="HTML1"></div>

That empty DIV is a major problem because now we have to figure out a CSS workaround for whether the content is displayed or not. Having to code a workaround actually limits our range styling options. If pageType was an attribute of the WIDGET tag we'd no longer have have empty DIVs and thus could style the widgets the way we originally intended. A homepage value for the pageType attribute would ensure that a page element only appears on the home page; there currently exists no equivalent.


search pageType Value Proposal


The index value indicates when the user is on a page that starts with http://BLOGDOMAIN/search. It also indicates that the user is on the homepage or is browsing through older/newer pages from the homepage. Thus, there's doesn't exist a way to tell the difference between browsing and searching. I tried using the following condition to determine if a search was performed:


<b:if cond='data:navMessage'>


Unfortunately 'navMessage' is a variable exclusive to the Blog widget; meanwhile, the search term itself is obfuscated by surrounding text. With a search pageType we'd be able to determine from the vantage point of any widget if the user has triggered a search. And with a variable for the actual search term we'd know what exactly the user was looking for. Having these tools at their disposal will empower template designers to forge a more comprehensive search page.

It should be noted that 'navMessage' still works even if the search results span multiple pages—including labels.


all Value Proposal


If the pageType attribute is being used on a page element which you've decided should appear on all pages you'll have to either deleted or comment out the following two lines:

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

Having all would make this a simple matter of changing the pageType value. There's no need for a hide value at the current time because typing anything other than accepted pageType values prevents the page element from displaying.


Rational


While I sometimes wish Blogger had a richer feature set—post summaries, post categories, post thumbnails, the inclusion of || and && for conditions—implementing such ideas requires more time and research. The goal of this proposal is to simply iterate on already existing functions of the Blogger template system. I hope this isn't asking for too much. It is my belief that Blogger is the BEST free blogging platform on the Internet and with these proposed iterations it can only get better.

To clarify I'm not proposing that pageType be moved to the WIDGETS tag, I'm proposing that pageType be added to the WIDGETS tag.


How To Raise Awareness


Go to Page Elements Tags for Layouts, scroll down and select "No." This page has many inaccuracies (e.g., it says to lock a widget the Locked attribute must equal yes, that doesn't work: the value must equal true). Once should should be sufficient.

Go to the Blogger Wishlist, click on "Have more template options", paste the permalink of this blog entry into the form field and post a brief message explaining why you think this is important.

Link to this post on your blog and relevant social bookmarking sites. If you're skeptical and think this is some elaborate scheme to raise my PageRank score then go right ahead and "nofollow" the link. The spread of information is my only concern.

9 Comments

Alain-Christian - #
January 31, 2009 at 5:10 PM
Subject verb agreement went right out the window!
Alain-Christian - #
January 31, 2009 at 6:16 PM
You know what I forgot? I forgot to mention a mobile value.

Oh well.
Tuan Anh - #
February 26, 2009 at 12:17 PM
I agree with you. We have many troubles without pageType specifications. I cannot make Blogger understand where is the Search page, where is the Label page to change some layout for these type of pages. So sad. Hope Google will change this in the near future.
Alain-Christian - #
February 28, 2009 at 5:43 PM
For about two days Blogger was taking suggestions through moderator but deleted it soon afterwards. Lame.
Kaushik - #
February 15, 2010 at 12:11 AM
I came to this blog looking for pagetype of the newly introduced Pages (found it on another post). I whole heartedly agree with you on the need for separate pagetypes for lable and search.

I suggest you send this post to one of the Google fellas you can find on Blogger support forums. Or post it in a comment in Blogger in draft blog.
Alain-Christian - #
February 15, 2010 at 7:10 PM
Well, there isn't a pageType for searches but I found a way to get it done:
Customize Blogger's Search Result Pages With searchQuery

I have another post I'm in the middle of writing for label pages. I think after this I'm just going to write post snippets because it takes me forever to write these guides. X(
Alain-Christian - #
February 15, 2010 at 7:11 PM
I meant CODE snippets, not post snippets.
known as Jamed - #
March 4, 2011 at 10:08 AM
I wanted to display a widget in other Pagetype I have on my blog. As I can see in here, there is no PageType for static page and label. Who can I display a widget on static page and label page without it showing on Homepage?
I try changing the code



into (not equal)



but it won't work.

can you help me please... I have a flash slideshow that I wanted to appear on my home page and not on other pages. but I wanted a small widget that will hold this flash slideshow on other pages.

here is my blog.. http://hollywoodmoviestowatch.blogspot.com

Thanks!
Alain-Christian - #
May 23, 2011 at 1:49 AM
This document is officially out of date and depreciated!

@Tuan Anh
I've posted a new guide tonight called 7 Blogger Page Types: Analysis, Code Snippets, Data Matrix. It includes info on Search, Label pages as well as others.

@Kaushik
Same thing. The new guide I posted has info on Search and Label pages.

@known as Jamed
I dunno if you tried to code some code in your comment but it looks like it got stripped out. In any event the new article I posted on the 7 Blogger Page Types includes snippets and should help you achieve what you're trying to do. If you still have trouble let me know in that post and I'll see what I can do.

Add a Comment