Whereas,there are some widget which is not needed in particular areas of your blog.
E.G,Widgets like Recent comments,Related posts,Recent posts,Top commentatorsetc...which are not needed in static pages &sometimes homepage are displayed everywhere,thereby flooding your blog with extraneous widgets.
Fortunately,there are some conditional tags which will help solve this problem.
A Conditional tag consists of two sections of codes i.e,A <b:if+condition> and a matching end tag which is </b:if>
HOW TO DISPLAY/HIDE WIDGETS ON BLOGGER.
- To display/hide widgets on specific pages,you have to know that particular widget's id first[You can leave a comment below if you don't know how to get it.]
- Login to Blogger » Design/Layout » Edit HTML.
- Check the box next to
Expand Widget Templateand search for the widget's Id.
APPLYING CONDITIONAL TAGS.
On getting the widget's id,you will get something like this»<b:widget id='HTML1' locked='false' title='' type='HTML'>
<b:includable id='main'>
CONDITIONAL TAG GOES HERE <!-- 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'/>CLOSING TAG.
</b:includable>
</b:widget>
Below are the conditional tags to replace with the ones in the widget above.
TO SHOW A WIDGET ONLY IN HOMEPAGE.
<b:if cond='data:blog.url == data:blog.homepageUrl'>SHOWING WIDGET ONLY IN LIST PAGES.
<b:if cond="data:blog.pageType == "index"">SHOW WIDGET ON ONLY POST PAGES.
<b:if cond='data:blog.pageType == "item"'>SHOW WIDGET ON A SPECIFIC PAGE.
<b:if cond='data:blog.url == "URL OF PAGE"'>SHOW WIDGET ON ARCHIVE PAGES ONLY.
<b:if cond='data:blog.pageType == "archive"'>SHOW WIDGET ONLY ON STATIC PAGES.
<b:if cond='data:blog.pageType == "static_page"'>SHOW WIDGET ON BOTH POST & STATIC PAGES.
<b:if cond='data:blog.url == data:post.url'>SHOW WIDGET ON ONLY LABEL-SEARCH PAGES.
<b:if cond='data:blog.searchLabel'>NOTE:-Whenever you use any of the codes above,do not forget to include the matching end tag,i.e </b:if>
ENCOUNTERED ANY DIFFICULTY?DO NOT FORGET TO LEAVE A COMMENT BEHIND!!!
Tidak ada komentar:
Posting Komentar