How to Show Blogger Widgets Only On Select Pages

 

On Wordpress blogs it is very easy to show widgets and ads and pretty much anything that can be put in the sidebar only on selct pages, for instance the home page, archive pages, and so on. Unfortunately, things are not as easy on Blogger because here all sidebar widgets are, by default, linked to all pages. In this post I am going to show you a method that lets you choose on which pages a specific widget will appear.

How to show Blogger widgets on select pages only

1. Sign in to Blogger. Go to Dashboard --> Design. Add widget and position it where you like.

2. Now go to Edit HTML and check "Expand Widget Templates".

3. Search for (Ctrl + F)

<b:widget id='HTML3' locked='false' title='The title/name you gave to your widget' type='HTML'>

The number in red can be pretty much anything. It depends on the number of widgets you added before the one you want to show only on select pages .If you don’t know the number just search for

<b:widget id='HTML

You will find a number of codes starting like this, so you need to look for the name of the widget you want to show on different pages.

4. Now add one of the codes in red as shown below.

If you want the widget to appear only on the home page

<b:widget id='HTML5' locked='false' title='Widget Title Name' 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 != &quot;&quot;'>
<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 display a widget on all posts pages but not on the home page

<b:widget id='HTML3' locked='false' title='Widget Title Name' 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 != &quot;&quot;'>
<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 display a widget only on archive pages

<b:widget id='HTML3' locked='false' title='Widget Title Name' 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 != &quot;&quot;'>
<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>

That’s all!

Good luck!

P.S.: If you have any problems with this hack, please leave a comment.

0 Comments:

Post a Comment