How to add Google Adsense Custom Search Box on Discourse Search page?

Also, it is great way to monetize the forum using Adsense search ads when people search for topics on discourse.
Adsense gave me 2 codes,

  1. one for showing the search box and search icon
  2. ONE to place on the actual search page which is

But they both are JS script tags and if i follow this How to add custom content that only appears on your homepage and try to add the JS script tag inside the Handlebar JS code, it gives me syntax error, i am unable to put the script tag inside it.

Please see Implement a custom search engine - AdSense Help

The 2 codes look something like this:

<script async src=''></script><div class="gcse-searchbox-only"></div>

And the other one
<script async src=''></script><div class="gcse-searchresults-only"></div>

Where and how can i put these on my disocurse forums so they can be rendered correctly on correct places?

I don’t think this will be possible in Discourse.

I created a component about this topic, you might be interested in: Hide Discourse's search and use Google's

1 Like