Thursday, May 21, 2009

Add adsense ad, link unit or page element below header

Many blogs have good blogger template and they want to add the google adsense link unit or google adsense ad below header or title. How to do it?

For this purpose either they can change the whole template or do the simple html code editing mentioned here. This widget / trick actually gives additional 'Add gadget' (add page element) option above the header.

Go to your Dashboard > layout > edit HTML > then search for

<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='your blog title (Header)' type='Header'/>
</b:section>
</div>

Now you need to edit this code as shown below

change maxwidgets='2'
change showaddelement='yes'
change locked='false'

your code should now look like this

<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='2' showaddelement='yes'>
<b:widget id='Header1' locked='false' title='your blog title (Header)' type='Header'/>
</b:section>

Now go to Layout , you will find Add a gadget option above the header . Now click on it and you can add adsense link unit or ad unit or some other gadget. Then click save.

Your adsense ad will start showing above the header.

But suppose you want it below the header then how to do it ?

Sometimes you can not drag it in layout screen . So again go to Edit HTML and search for the code and then swap the lines as shown below and then click save. Now your ad unit is below the header.

<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='2' showaddelement='yes'>

<b:widget id='Header1' locked='false' title='your blog title (Header)' type='Header'/>
<b:widget id='AdSense1' locked='false' title='' type='AdSense'/>
</b:section>

9 comments:

Anonymous said...

Wow It's great I was searching for this tweak all around the web. Finally I found it in your blog. I would like to give a million salute for this :-)

Yakimo said...

Awesome technique, worked perfectly on the Stretched Denim template. And more importantly I have learned the reason why some page elements weren't showing "add widget" while others were! Thanks.

Stu said...

I really want the adsense IN the header, a 468 banner on the right. Any way to do this?

Dotz said...

Hello Frend! U r soo cool ! i would like to meet you.. Hey friend how did u publish your blog on google?

if u dont mind Could you add me?
my id - dotzz@ymail.com

leopard said...

Thanks .This is very useful

Wild River Guitar said...

I like using this Tweak it one of theTips for BloggingI have Read and will be using it on my
Blog

Scripter said...

Really a great blog for blogging tips. Keep it up. Great work.

BooyaGadget said...

perfect. thanks !
very helpful.

LOL, we added pagetabs, then I lost my beloved link unit. back now. Booya

Amy said...

Thank you very much for posting this clear and helpful tutorial. It worked perfectly!