1) home page- yea its your blogs home page as the name suggests(actually this is not a type. but i will still include it here..)
2) Archive Page- Refers to archive pages..
3) Item Page - Refers to Post Pages
4) Index Page - Includes home page + label page + search results page
Selective Display..
There are different conditions to check the page type. You can use these conditions for the selective display.
You might like to display a welcome message on the home page only..
<b:if cond='data:blog.url == data:blog.homepageUrl'>
Welcome to my Blog
</b:if>
<b:if cond='data:blog.url != data:blog.homepageUrl'>
this is not the homepage
</b:if>
<b:if cond='data:blog.pageType == "archive"'>
Hii this is an archive page
</b:if>
<b:if cond='data:blog.pageType != "archive"'>
Hii this is an non archive page
</b:if>
<b:if cond='data:blog.pageType == "item"'>
Hii this is a post page
</b:if>
<b:if cond='data:blog.pageType != "item"'>
Hii this is a non post page
</b:if>
<b:if cond='data:blog.pageType == "static_page"'>
Hii this is a static page
</b:if>
<b:if cond='data:blog.pageType != "static_page"'>
Hii this is not a static page
</b:if>
Now displaying something on a particular url only (may be a particular post page only or something like that)
<b:if cond='data:blog.url == "The_Particular_Page_Url"'>
this will be displayed on The_Particular_Page_Url only
</b:if>
Now displaying something on all pages other than a particular url
<b:if cond='data:blog.url != "The_Particular_Page_Url"'>
this will not be displayed on The_Particular_Page_Url
</b:if>
<b:if cond='data:blog.url != "The_Particular_Page_Url1"'>
<b:if cond='data:blog.url != "The_Particular_Page_Url2"'>
this is not Particular_Page_Url1 and this is not Particular_Page_Url2
</b:if>
</b:if>
What if you need to display something on the homepage and something else on all other pages.. here comes the use of if else
<b:if cond='data:blog.url == data:blog.homepageUrl'>
This is the homepage
line1
line2
<b:else/>
This is not the homepage
line 3
line4
</b:if>
Limitations
1) I don't see a way to use OR conditions
2) There isn't any direct easy way to include AND in conditional statements
3) The main drawback is that we cant enclose an entire widget within the b:if tag.. you will get some message telling that a b:section cant have b:if s ie you can wrap an unexpanded widget within a b:if condition
Wrapping a widget with the conditional tags
Every widget other than the BlogPost Widget has this general structure
<b:widget id='something' locked='' title='' type=''>
<b:includable id='main'>
somethings here
</b:includable>
</b:widget>
<b:widget id='something' locked='' title='' type=''>
<b:includable id='main'>
<b:if cond='data:blog.url == "The_Particular_Page_Url"'>
some things here
</b:if>
</b:includable>
</b:widget>
Another Limitation..
wrapping the blogpost widget is little complicated as it has many b:includables.. yea you can do that too.. :)
Another Important B:if condition..
<b:if cond='data:post.isFirstPost'>
OH yea this is the first post on this page
</b:if>

0 التعليقات: