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 == "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>
Show Blogger Widget in Homepage and Other Pages (except Post Pages)
<b:includable id='main'> <b:if cond='data:blog.pageType == "index"'> <!-- 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 == "URL of the page"'> <!-- 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.
This was a great post - save the day for me!
ReplyDeleteOne comment is that it was hard to find your post because the "widgets" are actually called "gadgets" in the Google universe.
Post title should be:
Show Blogger Gadgets in Specific Posts or Pages
Thanks!
tpuerzer
Thank you Tpuerzer, I'll keep that in mind.
ReplyDeleteHow to I hide the widgets for only one particular page?
ReplyDeleteI found my answer on another post of yours! Thanks for posting!
ReplyDeleteThis works great but I also want to hide it when someone filters/views labels. Any suggestions?
ReplyDeleteAre you asking for creating separate label or archive page for Blogger?
ReplyDeleteThank you for providing such good information,but i want to hide widgets on static pages..
ReplyDeleteThen use conditional tags for static pages, i.e.
ReplyDelete<b:if cond='data:blog.pageType == "static_page"'>
...
</b:if>
i am trying it let see wat happen
ReplyDeleteI want to "Hide Widget on Particular Post"..
ReplyDeletePlease help!!
Use specific URL conditional tags for Blogger.
ReplyDeleteWhich blogger templete are you using..please tell..
ReplyDeleteRead the about page. It's told there.
ReplyDeleteBrilliant, this worked perfectly for me.
ReplyDeletei was wondering if it is possible to show a widget on the post page with a certain label,,
ReplyDeletefor example
label: facebook
widget shows on all of the post with label facebook
thanks to anybody who can figure this out
if so please contact me here http://www.theemolab.com/p/contact-us_27.html
This can be done using proper conditional tags with conjunction with this tutorial.
ReplyDeleteAwsome! man good job keep it up
ReplyDeleteHello Raju
ReplyDeleteI want to know how to show widgets only on search page in blogger.
It totally depends on where your search page exists.
Deletei was wondering if it is possible to show a widget on the post page with a certain label,,
ReplyDeletefor example
label: facebook
widget shows on all of the post with label facebook
any answer for this question?
Didn't worked on it so can't give you any definite answer but try the using the conditional tags.
Delete