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.
The code given as in TE, did not work with double quotation there...
I figured it was this problem:

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

<b:if cond='data:blog.url == data:blog.homepageUrl'>
<a expr:href='data:blog.homepageUrl'><data:title/></a>
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 cond='data:blog.pageType == &quot;item&quot;'>

display this one only in post page



Inspired by:
TE article:
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<p>This sentence will only show on a post page.</p>
Converted to code:

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