Show Blogger Gadgets/Widgets in Specific Posts or Pages

Today I will tell you how to show different Blogger gadgets or widgets on different or specific posts or pages. Previously we learned about conditional tags and how to use it. In this tutorial we need these tags to hide the gadgets.

So first go to Blogger’s Layout tab and add a “HTML/JavaScript” gadget. I prefer it because it will be easy for everyone to understand. Give it a unique tile so that it does not match with any of the titles of other widgets added (if any).

Now got to Template tab, click “Edit HTML” and check “Expand Widget Templates”. Now press “Ctrl+F” on your keyboard to open the browser’s search bar and search for the “unique” title that you have given to your gadget. Let’s say I have given the title for my widget as “My Widget”. After searching you will find the below snippets:

<b:widget id='HTML1' locked='false' title='My Widget' type='HTML'>
<b:includable id='main'>
<!-- 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:includable>

It's the widget or gadget that you have added from Layout tab. All is left is to add conditional tags just below <b:includable id='main'> and above </b:includable> to hide the widget form specific pages or posts in Blogger. Let us see some examples:

Show Blogger Widget/Gadget in Post Pages only

If you want to hide any widget or gadget from showing it on homepage or other page and to show it on post pages then you have to add the conditional tags as shown below:

<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 != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>

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

Show Blogger Widget in Homepage and Other Pages (except Post Pages)

<b:includable id='main'>
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<!-- 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>

Show Widget/Gadget on a Particular Post

<b:includable id='main'>
<b:if cond='data:blog.url == &quot;URL of the page&quot;'>
<!-- 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>

Conclusion

Above are some examples for some of the pages. If you have followed to how to use conditional tags in Blogger, then you can hide particular widgets and gadgets from appearing on particular pages you want. One of it can be found on my explore page.

Popular posts from this blog

How to Add Extra Gadget/Widget Section to Blogger Header

Add Google Web Fonts to Blogger

Add Open Graph Protocol Meta Tags to Blogger