I wanted to have title like:

Post title - Blog title

After few tries and got a very important tag blog.pageName from Internet, I finally could make it happened. The official Blogger document Layouts Data Tags is not really helpful for this, it doesn’t mention about blog.pageName and the new pageType of pages static_page.

The following template code is what this blog is using:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
    <title><data:blog.pageName/> &lt;&lt;&lt; $(<data:blog.title/>)</title>
<b:else/><b:if cond='data:blog.pageType == &quot;static_page&quot;'>
    <title><data:blog.pageName/> &lt;&lt;&lt; $(<data:blog.title/> --page)</title>
<b:else/><b:if cond='data:blog.pageType == &quot;archive&quot;'>
    <title><data:blog.title/> --in &#39;<data:blog.pageName/>&#39;</title>
<b:else/><b:if cond='data:blog.pageName != &quot;&quot;'>
    <title><data:blog.title/> --query &#39;<data:blog.pageName/>&#39;</title>
<b:else/>
    <title><data:blog.pageTitle/></title>
</b:if></b:if></b:if></b:if>

It have four if clause to do something like switch in C code, it reads more like Python way. The first part item is for posts, static_page for pages, archive for archive pages. The last part—page type is index, it checks if page name is not an empty string, then the current page could be a search result page or label page; homepage or some others not covered if page name is an empty string.

I would like to have some like blog.archivePageYear and blog.archivePageMonth, or to be able to distinguish searching and label pages. So, I could make title read like YJL --verbose --search 'keyword' or --label 'label' or --year 2010 --month September.