Walker News

How To Embed Adsense Search In New Blogger Template

No doubt it’s easier to embed the Adsense Search code in New Blogger template via the HTML/JavaScript widget (a.k.a Page Element).

But, the Page Element is less useful when you expect to control the position of Adsense Search placement.

In other words, you’ll have to write and save the Adsense Search code directly in the New Blogger HTML template (in HTML source, not the Page Element!).

However, saving the original Adsense Search code in New Blogger template will be failed with an error message similar to this:
We were unable to save your template
Please correct the error below, and submit your template again. 
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. 
XML error message: Attribute name "checked" associated with an element type "input" must be followed by the ' = ' character.

How to embed Adsense Search code in the New Blogger HTML template?

In order to successfully embed and save the Adsense Search code in the New Blogger HTML template, the same little HTML hack has to be applied (similar with How to add ShareThis JavaScript Snippet into New Blogger template?):
  1. Copy the Adsense Search code to Notepad,
  2. Locate the pair of HTML INPUT tag with CHECKED attribute,
  3. Replace these characters – <, > and checked – with their HTML code representation respectively, i.e. that line will becomes as this
    &lt;input type="radio" name="sitesearch" value="WalkerNews.net" &#99;&#104;&#101;&#99;&#107;&#101;&#100; id="ss1"&gt;&lt;/input&gt;
  4. Paste and save the tweaked Adsense Search code into New Blogger template

Only by tweaking the original Adsense Search code, the Save Template action could be done successfully.

Is that legal to change/tweak Adsense Search Code?

The answer is similar with License To Tweak Adsense Code For New Blogger User.

Although the original Adsense Search code has been changed, it’s not tampered!

The tweaked Adsense Search code appears exactly the same when viewing in web browser page source! (E.g. rewrite the CHECKED attribute with its HTML code representation – &#99;&#104;&#101;&#99;&#107;&#101;&#100;)

If you pay close attention, New Blogger template will automatically rearrange JavaScript attribute elements in the Adsense code after each time saving the template.

That’s the “license” for New Blogger users to change/tweak original Adsense code! (And, it’s the trick – the little HTML hack – to save Adsense Search snippet in New Blogger HTML template!)

If you’re not comfortable with this hack, please ignore my trick or think about of switching New Blogger to WordPress blogging tool!

Custom Search

2017  •  Privacy Policy