Embedding Google Search Results on blog
Posted: Fri Mar 28, 2008 5:22 pm
So, like many bloggers, I use adsense on my blog Yet Another Linux Blog.
One thing that I've done is take away my custom error pages done years ago and replaced them with static pages (using the static pages plugin). This makes things a bit more "all inclusive" feeling because everything is themed just like my blog and navigation is still intact.
On each of these static pages, I provide a google search form that will search my blog. With default behavior from google, they are directed AWAY from my blog to a results page. This isn't what I want my traffic to do...I need to keep visitors there for as long as possible so they can discover my unique content
Enter google's "display search results on your page" tool in adsense. You are supposed to be able to setup a page that will display a dynamic frame of search results based upon the search form on your site.
So, I setup a static page called results.html with the static page plugin and posted the code needed to display things:
I removed all markup on this static page. Now when someone hits an error page and uses a search form I display there, they should be directed to http://linux-blog.org/results.html for their search results.
When people hit the search button now, they're directed to my front page and not their search results. Not the correct behavior. Since google provides the same generic code for all websites...I think this is something s9y is doing.
The problem is, this isn't working. I have no idea why it wouldn't work. Does anyone have any idea what I'm doing wrong here?
For reference: How to Set this up on Wordpress
Google Search Form Code:
Any help is appreciated.
Test this out yourself:
My Search Page: http://linux-blog.org/index.php?/advsearch.html
Results should display: http://linux-blog.org/index.php?/results.html
One thing that I've done is take away my custom error pages done years ago and replaced them with static pages (using the static pages plugin). This makes things a bit more "all inclusive" feeling because everything is themed just like my blog and navigation is still intact.
On each of these static pages, I provide a google search form that will search my blog. With default behavior from google, they are directed AWAY from my blog to a results page. This isn't what I want my traffic to do...I need to keep visitors there for as long as possible so they can discover my unique content
Enter google's "display search results on your page" tool in adsense. You are supposed to be able to setup a page that will display a dynamic frame of search results based upon the search form on your site.
So, I setup a static page called results.html with the static page plugin and posted the code needed to display things:
Code: Select all
<!-- Google Search Result Snippet Begins -->
<div id="googleSearchUnitIframe"></div>
<script type="text/javascript">
var googleSearchIframeName = 'googleSearchUnitIframe';
var googleSearchFrameWidth = 530;
var googleSearchFrameborder = 0 ;
var googleSearchDomain = 'www.google.com';
</script>
<script type="text/javascript"
src="http://www.google.com/afsonline/show_afs_search.js">
</script>
<!-- Google Search Result Snippet Ends -->
When people hit the search button now, they're directed to my front page and not their search results. Not the correct behavior. Since google provides the same generic code for all websites...I think this is something s9y is doing.
The problem is, this isn't working. I have no idea why it wouldn't work. Does anyone have any idea what I'm doing wrong here?
For reference: How to Set this up on Wordpress
Google Search Form Code:
Code: Select all
<!-- SiteSearch Google -->
<form method="get" action="http://linux-blog.org/index.php?/results.html" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="linux-blog.org"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Google Search" id="sbb"></input>
</td></tr>
<tr>
<td> </td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="linux-blog.org" checked id="ss1"></input>
<label for="ss1" title="Search linux-blog.org"><font size="-1" color="#000000">linux-blog.org</font></label></td>
</tr>
</table>
<input type="hidden" name="client" value="mynumber"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="mychannel"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="safe" value="active"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#33628C; VLC:663399;AH:center;BGC:FFFFFF;LBGC:33628C; ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF; GIMP:0000FF;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->Any help is appreciated.
Test this out yourself:
My Search Page: http://linux-blog.org/index.php?/advsearch.html
Results should display: http://linux-blog.org/index.php?/results.html