Wednesday, January 6, 2010

Understanding and using Page Types in Blogger

Here is the motivation: You want to show only certain gadget for instance google friend connect bar at the top/bottom only on the index page or post page.
I would recommend the TE article (see below) first to understand the page type.
<p><data:blog.pageType/></p>
The code given as in TE, did not work with double quotation there...
I figured it was this problem:
&quot;index&quot;
versus
"index"

Once that was figured out, it was easy to understand:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
<data:title/>
<b:else/>
<a expr:href='data:blog.homepageUrl'><data:title/></a>
</b:if>
just simple if-else statement!
************
Now the following code can be implemented in the body section, so that the item inbetween if tag is displayed only in home page.
It works!
<b:if cond='data:blog.pageType != &quot;item&quot;'>
this one is displayed only in home page.
</b:if>
***
<b:if cond='data:blog.pageType == &quot;item&quot;'>

display this one only in post page


</b:if>

***



Inspired by:
TE article: http://technicallyeasy.net/2009/12/understanding-blogger-page-types/
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<p>This sentence will only show on a post page.</p>
</b:if>
Converted to ht.ml code:
http://www.eblogtemplates.com/blogger-ad-code-converter/

No comments:

Post a Comment

Thanks for the comment.
Please stay on topics; off-topic/advertisement comments will be removed.

You may also like to visit : My Frame of Reference
(Press shift while clicking: Opens in New window.)