Every Widget/Gadget you add in blogger automatically shows on all pages but sometimes, you might wish to have a widget appear just on the homepage only and nowhere else. If you’ve noticed, there are some page elements on this site’s homepage that won’t appear on post pages and you can do this for ads, html/javascript or any other page element. Instead of just making the widget appear on the homepage only, you can as well make it appear on a particular post page only.
How To Make Widget/Adsense Unit Appear On The Homepage Only
To do this, you need to first know your widget ID by following the steps below:
1. Log in to blogger
2. Go to Design and locate the widget you wish to appear at the homepage only
3. Right-click on the ‘Edit’ below the widget and copy link location
4. Paste the link to a notepad and locate the widget ID.
For an adsense unit, it should look like this:
http://www.blogger.com/rearrange?blogID=7243280908926933904&widgetType=AdSense&widgetId=AdSense2&action=editWidget§ionId=sidebarleft
For a HTML/Javascript widget, it should look like:
http://www.blogger.com/rearrange?blogID=7243280908926933904&widgetType=HTML&widgetId=HTML7&action=editWidget§ionId=sidebarleft
5. Copy out the widget ID (written in the example above in red)
6. Now go to Edit HTML and check the box labelled Expand Widget Template (I suggest you always back up your template before editing your template)
7. Press CTRL + F and find the widget ID you copied earlier.
8. In the line directly below that widget ID, you should see this piece of code:
<b:includable id='main'>
9. Immediately below this, paste the code below:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
10. Now scroll down a bit (maybe 5-10 lines) till you find this code:
</b:includable>
11. Just above this, paste this code:
</b:if>
The screenshot above shows what it should look like for an HTML widget.
That’s it. Save your template and you’ll now see the widget only appears on the homepage so far you got the steps right.
How To Make Widget/Adsense Unit Appear On Blog Post URL
The process is similar to the one above but there’s a litle difference in Step 9. you only need to replace:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
With this:
<b:if cond='data:blog.url == "Blog Post URL"'>
Be sure to replace Blog Post URL with the url you want the widget to appear. Save your changes and visit your blog.
How To Make Adsense Unit/Widget Display On List Pages (Homepage, Label Pages & Yearly Archive)
In step 9, use this code instead:
<b:if cond='data:blog.pageType == "index"'>
How To Make Widget Show On Post Pages Only
Use this code on step 9
<b:if cond='data:blog.pageType == "item"'>
Making Widget/ Display on Archive Pages Only
<b:if cond='data:blog.pageType == "archive"'>
Making Widget/Adsense Unit Display on Static Pages Only
<b:if cond='data:blog.pageType == "static_page"'>