Simple Blogger Tutorials

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.

21 comments :

  1. Anonymous22 May, 2011

    This was a great post - save the day for me!

    One 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

    ReplyDelete
  2. Thank you Tpuerzer, I'll keep that in mind.

    ReplyDelete
  3. How to I hide the widgets for only one particular page?

    ReplyDelete
  4. I found my answer on another post of yours! Thanks for posting!

    ReplyDelete
  5. This works great but I also want to hide it when someone filters/views labels. Any suggestions?

    ReplyDelete
  6. Thank you for providing such good information,but i want to hide widgets on static pages..

    ReplyDelete
  7. Then use conditional tags for static pages, i.e.

    <b:if cond='data:blog.pageType == "static_page"'>
    ...
    </b:if>

    ReplyDelete
  8. i am trying it let see wat happen

    ReplyDelete
  9. I want to "Hide Widget on Particular Post"..
    Please help!!

    ReplyDelete
  10. Which blogger templete are you using..please tell..

    ReplyDelete
  11. Read the about page. It's told there.

    ReplyDelete
  12. Brilliant, this worked perfectly for me.

    ReplyDelete
  13. i was wondering if it is possible to show a widget on the post page with a certain label,,

    for 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

    ReplyDelete
  14. This can be done using proper conditional tags with conjunction with this tutorial.

    ReplyDelete
  15. Awsome! man good job keep it up

    ReplyDelete
  16. Hello Raju
    I want to know how to show widgets only on search page in blogger.

    ReplyDelete
    Replies
    1. It totally depends on where your search page exists.

      Delete
  17. i was wondering if it is possible to show a widget on the post page with a certain label,,

    for example

    label: facebook
    widget shows on all of the post with label facebook

    any answer for this question?

    ReplyDelete
    Replies
    1. Didn't worked on it so can't give you any definite answer but try the using the conditional tags.

      Delete

Don't SPAM! Read comment policy.

Like