How to make Blogger Gadgets appear on Homepage or Single Post only


This will make your gadgets or widgets in Blogger magically disappear from homepage or single post. How to do it? By adding a simple binding b:if conditions. This has been used in read more blogger hack. We just need to explore it.
How to make gadgets appear on HOMEPAGE only
Step 1: Go to your layout>edit html (be sure to back up your template just in case something goes wrong or you didn't like the result).
Step 2: Find the HTML number for the gadget you want to disappear in the single post.
I just take a look of my page then view its source. I take note of the HTML number of the gadget I need to adjust)
Add this code <b:if cond='data:blog.url == data:blog.homepageUrl'>
just after <b:includable id='main'> then enclose it at the following </div>

Here's what it will look like after pasting the two codes. The codes added are highlighted in red.
<b:widget id='HTML1' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- 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:if>

How to make gadgets appear on SINGLE POST only
Same as above, only the first code will change.
Step 1: Go to your layout>edit html (be sure to back up your template just in case something goes wrong or you didn't like the result).
Step 2: Find the HTML number for the gadget you want to disappear in the single post.
I just take a look of my page then view its source. I take note of the HTML number of the gadget I need to adjust)
Add this code <b:if cond='data:blog.pageType == "item"'>
just after <b:includable id='main'> then enclose it at the following </div>

Here's what it will look like after pasting the two codes. The codes added are highlighted in red.
<b:widget id='HTML2' locked='false' title='' 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:if>

And that's it! You can now make gadgets appear and disappear and your blog will not have the same look from homepage to single post. TIP! Use this to interchange your ads! Like I did on this site! Or you can create a Google blogger template like this one!



Bookmark and Share
If you enjoyed this post please subscribe to Keybol with your email address:Delivered by FeedBurner

0 comments:

Post a Comment

Please leave your comments, questions, and/or tips here.

Blog Archive

 
| play now free games online