November 4, 2008

Showing a gadget on your Blogger homepage only

A gadget that you added on Sidebar or Footer always appears on our homepage and all posts pages. But you can custom its contents that are only shown on your homepage or each post page through this example.

By signing in Blogger, click on Layout tab | Edit HTML and check the "Expand Widget Templates" box. Use search keywords below to find your gadget:



For example, I want to set up for id='HTML1'. Pay attention to the highlighted code added into your template, this makes your gadget be shown on homepage:

<b:widget id='HTML1' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType != &quot;item&quot;'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<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>


On the other way, this is shown on each post page:

<b:widget id='HTML1' locked='false' title='' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<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>

1 comments: