Adding Search to my Blog

**UPDATE!
**People (on other websites) have implemented this search feature, without adding the appropriate (uneditted) Google logo on their website, as described mandatory in this, this and this document. It seems that for some, all indexed pages on Google have been removed because of this!
What other websites decide, is up to them. Here on BloggingAbout.NET we’ve decided it’s no longer allowed to add Google search, so there’s no doubt we’ll never run into ‘troubles’.

David Cumps has created javascript code to add search to his weblog. It’s a simple but very effective solution, and I always wanted search on my blog. So until the next version of .Text is released (or CommunityServer :: Blogs) I have ‘implemented’ David’s search.

As David’s code is for weblogs.asp.net I changed the bit for our own blogs. If bloggers here also want to use it, follow these steps:

  • Go to your blog’s Admin section
  • Go to the tab Options
  • Select Configure
  • At the bottom of the page, add the following code to the box Static News
.csharpcode { font-size: 10pt; color: black; font-family: Courier New , Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0px; } .rem { color: #008000; } .kwrd { color: #0000ff; } .str { color: #006080; } .op { color: #0000c0; } .preproc { color: #cc6633; } .asp { background-color: #ffff00; } .html { color: #800000; } .attr { color: #ff0000; } .alt { background-color: #f4f4f4; width: 100%; margin: 0px; } .lnum { color: #606060; } <h3>Searchh3> <input class=”BlogSearch” type=”text” name=”searchBox” id=”blogSearchText” value=”” onkeypress=”return blogSearch(event, this);”> <input type=”button” value=”Search” onclick=”return blogSearch2(‘blogSearchText’);” class=”BlogSearchButton”> <script type=”text/javascript”>

function blogSearch(event, oInput) { var keyCode = (event) ? event.keyCode : keyStroke.which; if (keyCode == 13) { top.location = ‘http://www.google.com/search?q=’ + escape(oInput.value) + ‘+inurl%3Adennis+site%3Awww.bloggingabout.net’; return false; } return true; }

function blogSearch2(oInputId) { var oInput = document.getElementById(oInputId); top.location = ‘http://www.google.com/search?q=’ + escape(oInput.value) + ‘+inurl%3Adennis+site%3Awww.bloggingabout.net’; return false; } script>

  • Don’t forget to change dennis into your own blog url directory.
  • Save
  • Admire your new search

All credits of course go to David and apperently Geoff.