Saturday, September 11, 2010

Make widget to appear only on the homepage or post pages - blogger

To be more clear about what I mean look at this post: Show Related Article, Post, categories on blogger

Login to blogger dashboard - Layout/Design - Edit HTML - check-list Expand widget templates, and find the section code of your widget that would be set to be appear on the home page only, or post-page only.

1 - Look at the red code , the following code will make a widget appear only on the post pages, and not appear on the homepage of your blogger blog

Code:
<b:if cond='data:blog.pageType == "item"'>

</b:if>


Example :

<b:widget id='HTML15' locked='false' title='Related Articles' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>

<b:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>


2 - Look at the red code , the following code will make a widget appear only on the home-page, and not appear on the post-pages of your blogspot blog

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

</b:if>

Example:

<b:widget id='HTML12' locked='false' title='Advertising' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.homepageUrl == data:blog.url'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>

<b:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>


Related:
How to show / display only Post Title when click label on blogger/blogspot

and learn more other blogging tips and tutorials here : Blog tips and tutorials
blog tips and tutorials
Ok,

4 comments:

  1. can i make the blog itself not show on the homepage?

    ReplyDelete
  2. hey thank you very much.........
    good work... thanx a lot
    visit my blog http://streamtv24.blogspot.com

    ReplyDelete

Please leave your comments or your promotion links, but don't add HTML links into the comment body, because I consider it as a spam, and will be delete..

Thank you for your visit..