All You Need To Know About Earning First $100 from Google Adsense Visit Post

Hide Or Show Widgets in Home/post/static/archive pages in Blogger

Posted By : Satyendra Maurya | Last Update : 10:53 PM | Category :
We sometimes are having a use of hiding or showing blogger widgets in the posts pages or display them in home but not displaying in posts pages.
Because sometimes it happens that ads unit are placed in widget which are displayed in privacy policy pages which lead to disabling of Adsense account.
Therefore, it is required to hide elements inside blog pages is not only a matter of design but also a requirement.

To do so Follow these steps:

Step 1.Go to Blogger.com
Step 2.Go to Dashboard >Layout
Name the HTML/Javascript gadget to identify it easily while working the widgets.
Step 3.Go to Template and click on Edit HTML
Step 4.Click anywhere inside the code area and press the CTRL+F.
The search box will be appeared.
Step 5.Find the HTML of your widget by typing the widget's name in the search box.
Press Enter.
For Example my widget is "Recent Posts" then after searching the widget's name i will get a similar code in our template:
<b:widget="" id="HTML1" locked="false" title="Recent Posts" 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>
</b:widget>

This code in red is the widget/gadget that we added in the layout.

Step 6.After finding the widget code ,add following conditional tags marked with red just below and above to hide the widget from specific pages or posts in Blogger according to your needs:

To show the widget only in homepage:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- 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>
</b:widget>

To show the widget only in post pages:

<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>
</b:widget>

To hide Blogger widget in post pages:

<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>
</b:widget>


To show widget in a specific page:

<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>
</b:widget>


To hide widget in particular page:

<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>
</b:widget>

To show widget only in static pages:

<b:if cond='data:blog.pageType == "static_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>
</b:widget>

To hide widget in static pages:

<b:if cond='data:blog.pageType != "static_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>
</b:widget>

To show widget only in Archive pages:

<b:if cond='data:blog.pageType == "archive"'>
<!-- 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>
</b:widget>

Step 7.If you are done now you can Save template to see the changes.
Done now!!!

1 comment:

  1. thanks for your idea

    all my websites buiding blogspot to be customized , everyone view to comments


    http://suachuadovanphong.blogspot.com
    www.nguonbuonhang.com
    www.chuyennhare.net
    www.chuyennhagiare247.net
    www.chuyennhare.com
    www.muathanhly.net
    www.muathanhly.com
    www.chothanhly.com

    ReplyDelete

Although every comment is appreciated, Keep in mind that any link or keyword in the comments may be the reason for deletion of your comment. Thanks for understanding!

#Techno Geek Network

#Proudly Hosted on Blogger


DMCA.com Protection Status

©2014-2016 Techno Geek Network | Technology and Science is What You Make It! | Designed by Satyendra