Hide or Show Widgets on pages on Blogger

In your template find your widget code you want to edit and proceed as followed. You only have to add the items that are bolded below to your blog

To show the widget only in Homepage:

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<b:includable id=’main’>
<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 Blogger widget only in post pages 

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<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 the widget in a specific page
 

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<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>

Note: Replace URL of the page with the address of the page in which you want the widget to appear

To hide a widget only in a particular page

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<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 widgets only in static pages

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<b:includable id=’main’>
<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 widgets in Static Pages

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<b:includable id=’main’>
<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 widgets only in Archive Pages

 <b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>
<b:includable id=’main’>
<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>

Mark as helpful.

Posted in: HTML