Gadgets

Display Gadgets On Only The Home Page Or Post Pages In Blogger

related posts widget

In this post we have a great Blogger trick that shows you how to have chosen gadgets appear only on your blogs home page or post pages.There are a number of reasons you may want to only display a gadget on either post page or home page for example if you use the read more feature you will want gadgets above and below the posts on the post pages.As AdSense only allow 3 units per page you may want to have a gadget within a post which will allow for an extra unit on the home page.You could even give your home page a totally different design to the posts.There are many reasons and I’m sure you will find this Blogger trick very useful designing your blog.So starting with Gadgets only on the Home page lets see how its done.

Update : You can also make gadgets only appear on the page of a specific post.

Update 2: Display Gadgets Added Directly To Your Template On Only Home Or Post Pages.

Steps To Display Gadgets On Home Or Post Pages

If the gadget you want is not already on your blog add it first.For this example i am using a test blog and i am going to use the same recent posts widget.I have already added it to the blogs sidebar.

Name The Gadget – You will later have to find the gadget in your blogs template so to make this easy make sure the gadget has a name or title, i am looking for my recent posts gadget so it has the title recent posts if the gadget you want to move does not have a title just give it the title xxxxx and you can remove it when finished.

Step 1 – In your dashboard Click ‘Layout’ > ‘Edit Html’ > Tick the ‘Expand widget templates’ box

blogger layout
blogger edit html
blogger expand widget templates

Step 2 – Now you want to find the gadget in your template so i looked for ‘Recent Posts’ you look for the title of your gadget or xxxxx if you used that name.
The easiest way to do this is to click ‘CTRL and F’ for a search bar to help find the code – for more info on this click the extra help link at the top of the post.

You want to find a section of code similar to the one below :

<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 != &quot;&quot;'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>

<b:include name='quickedit'/>
</b:includable>

For some gadgets like your archive the section will be larger but you want everything between :

<b:widget id=’HTML1′ locked=’false’ title=’Recent Posts’ type=’HTML’>

And

</b:includable>

Step 3 – Now we have the code for the gadget we have to add two pieces of code to make it display on the home page only.You can see the two pieces of code i added to make this happen in red below :

<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 != &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>

Copy the code in red and add in place for your gadget.

Take you time and make sure you have it added correctly, once your sure you can save your template.

Adding a gadget to your blog post pages only

To make a gadget display on the post pages only follow the same steps to find the gadget in your template.The only difference is the code added.This time you use the two piece of code shown below :

<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 != &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>

Once again copy the code in red and put it in place for your gadget.
When your sure the code is added properly save your template and your done.

You can do this with as many items in your sidebars as you like and with any gadgets, if you need extra help you only need ask in the comments.

Drop Your Comments And Questions Below.

Similar Posts

Display Gadgets On Only The Home Page Or Post Pages In Blogger
Informative
0
Useful
0
Easy To Read
0
Fact
0
Reader Rating0 Votes
0
0