Display Blogger Widget/Adsense Unit At The Homepage Only

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&sectionId=sidebarleft

For a HTML/Javascript widget, it should look like:

http://www.blogger.com/rearrange?blogID=7243280908926933904&widgetType=HTML&widgetId=HTML7&action=editWidget&sectionId=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"'>

Get free daily updates through email

avatar About Don Caprio

Don Caprio is a full time blogger / web designer living in Nigeria and apart from blogging, my other obsession is music. I'm a self-confessed Tupac fan, an iOS lover, an Android user, a Windows 8 power user, a writer with a 5-year old unfinished novel... and the list goes on and on. You can add me on Facebook, follow my updates on Twitter or add me to your circles on ! You can as well grab my feed and get updates through email.

Comments

  1. Nice post for blogger users!!

  2. Thanks Boss

  3. thanks a lot for this simple tutorial

  4. Thanks for sharing.
    Now i am applying this trick in my blog.
    Janmejaya recently posted..Make Money with Affilate MarketingMy Profile

  5. I LOVE this Post… Don thanks a lot dude ;)
    Jim Luthra recently posted..How to Put Two Adsense Ads Side by Side for BloggerMy Profile

  6. For wanting best adsense earning please place your ad with two adsense …..read how to combine two adsense ad
    Myblogtips recently posted..Download YouTube Video on Computer Without SoftwareMy Profile

  7. thanks DC, i so much appreciate your help, thanks again.
    Nigeria University news recently posted..JAMB UTME 2013 Registration For 2013/2014 Guidelines And Procedures | Jamb 2013 Direct EntryMy Profile

  8. thanks for this code, i so much appreciate it.
    make money online free
    make money online recently posted..Ways To Make Money Online Free And FastMy Profile

  9. thanks alot DC, i really appreciate this code.
    it is working perfectly..
    jamb 2013 result recently posted..JAMB 2013/2014 COURSES WITH THERE RELEVANT SUBJECTS .My Profile

  10. thank so much man.
    araba oyunları recently posted..Sünger Bop Uzay YarışıMy Profile

  11. ı don’t make,please help me!
    araba oyunu recently posted..Sünger Bop Uzay YarışıMy Profile

  12. Nice Post Don, Thanks for sharing it
    Samer recently posted..How to Dual Boot Windows 8 with Windows 7 (Complete Tutorial)My Profile

  13. huhu…
    thanks brother..
    It working.. now I can place 4 adsense ads with this trick…
    love your blog
    Abhijt recently posted..10 Best Professional Free Blogger Template Of 2013(Seo Friendly Theme)My Profile

  14. Thanks for this wonderful tip. Now i’m able to display blogger adsense unit in homepage. Nice illustrated article. Thanks.

Speak Your Mind

*

CommentLuv badge