How to Show or Hide Widgets on Blogger Specific Pages?



Generally, when we add a gadget in blogger then it would appear on all static pages like Homepages, Post Pages and Static pages. Sometimes people want to show some widgets on few parts of their website and remove unnecessary widgets from specific pages in blogger. This tutorial is all about how to show or hide widgets on blogger specific pages.

1. Log in to Blogger > >Dashboard.
2. Click on Drop Down Menu and Select Template.
3. Backup your Template before making any changes to your blog.
4. Now Click on Edit HTML.
5. Search for the title of the widget you want to control.
6. The code for the widget will look something similar to this one,

<b:widget id='HTML' locked='false' title='WIDGET-TITLE-HERE' type='Profile'>        
<b:includable id='main'>

WIDGET CODE GOES HERE

</b:includable>      
</b:widget>

On finding the title in place of WIDGET-TITLE-HERE you will find two similar codes like those I have shown in bolded blue, you just need to add the Controlling codes in the following manner. For example if you wish to show a widget at Homepage only then do this,

<b:widget id='HTML' locked='false' title='WIDGET-TITLE-HERE' type='Profile'>        
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>

WIDGET CODE GOES HERE

</b:if>
</b:includable>          
 </b:widget>

Where WIDGET CODE GOES HERE is the code of the widget you want to show or hide.

1. How to Display a Widget only on Homepage?
If you wants to show a widget on your homepage, add your gadget coding between these two lines. By using the following coding the gadget would only appear on your Home page.

<b:if cond='data:blog.url == data:blog.homepageUrl'>

WIDGET CODE GOES HERE

</b:if>

2. How to Hide a Widget on Homepage?
If you wants to restrict/hide a widget from the homepage, just add your gadget coding between these two lines. It will show the gadget on each and every page except homepage.

<b:if cond='data:blog.url != data:blog.homepageUrl'>

WIDGET CODE GOES HERE

</b:if>

3. How To Display a Widget only on Posts?
If you wants to show the gadget only on post pages, then use the following coding. By using the following coding the gadget would only appear on your Posts.

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

WIDGET CODE GOES HERE

</b:if>

4. How To Hide a Widget In Post pages?
If you wants to hide the gadget on post pages, then use the following coding. By using the following coding the gadget would hide on your Post pages.

<b:if cond='data:blog.pageType!= "item"'>

WIDGET CODE GOES HERE

</b:if>

5. How To Show Widgets Only On Selected Post?
If anyone wants to show the gadget only on selected post pages, then use the following coding. By using the following coding the gadget would only appear on your selected Posts.

<b:if cond='data:blog.url == "URL OF Selected Post"'>

    WIDGET CODE WILL GO HERE

    </b:if>

6. How To Hide Widgets On Selected Post?
Just paste your gadget coding between these two lines to hide a widget from your selected post.

<b:if cond='data:blog.url != "URL OF Selected Post"'>

    WIDGET CODE WILL GO HERE

  </b:if>

7. How To Display a Widget on Static pages?
If anyone wants to display a gadget on his Static pages then, use the following coding. It would appear only on Static Pages.

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

WIDGET CODE GOES HERE

</b:if>

8. How To Hide Widgets On Static Pages?
If anyone wants to hide a gadget on his Static pages then, use the following coding. It will show widget in each and every pages of your site except static pages.

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

    WIDGET CODE WILL GO HERE

    </b:if>

9. How to display a Widget on Archive pages?
If anyone wants to show a gadget on Archive pages then, use the following coding. It would appear only on archive pages and hide from all other pages.

<b:if cond='data:blog.pageType == &quot;archive&quot;'>

WIDGET CODE GOES HERE

</b:if>

10. How to Display a Widget on Homepage and Static Page?
Add your widget coding between these two lines. It will hide the widget from posts of your site except home page and static pages.

<b:if cond='data:blog.pageType != &quot;item&quot;'>

WIDGET CODE GOES HERE

</b:if>

11. How to display a Widget on Homepage and Post Pages?
If you desire to show certain HTML Coding on the homepage and posts. In this case, use the following coding and it would hide the gadget from Static pages except Home page and posts of your site.

<b:if cond='data:blog.pageType != &quot;static_page&quot;'>

WIDGET CODE GOES HERE

</b:if>

12. How to Display a Widget on Posts and Static Pages?
Add your HTML/JavaScript widget coding between these two lines. By using the following coding the gadget would appear on Posts page and Static pages and remain hidden from homepage.

<b:if cond='data:blog.pageType != &quot;index&quot;'>

WIDGET CODE GOES HERE

</b:if>


 Happy Blogging !!!

Comments

Popular Posts