Friday, September 18, 2009

Add Widget to Header | Add Widget to Post in Blogger

I was working in blogger and wanted to add AdSense to it in specific places. By default, I can add a html/javascript widget to the side bar, but there was no way to add a widget to the header or to the post. Wassupwidat?

I tried editing the HTML directly, but the AdSense ads wouldn't show. I didn't want to use the built in AdSense monetize featured because that doesn't allow for channel tracking. So I poked around a bit and found they way to do it.

Add widget capability to the header

Go to the edit html and look for
<b:section class='header' id='header'>
There might be some other stuff in there, but regardless you want to edit it to read:
<b:section class='header' id='header' maxwidgets='3' showaddelement='yes' preferred='yes'>
After you do that, when you go to the layout screen you'll have an Add Widget section. Now you can put in a html/javascript widget and put your adsense in there (or anything else).

Same thing for the post section. Look for something like:
<b:section class='main' id='main' showaddelement='no'>
And replace it with:
<b:section class='main' id='main' maxwidgets='3' showaddelement='yes' preferred='yes'>
Use the maxwidgets setting to control how many widgets you want to add.

No comments: