Dennis van der Stelt

The only way to win is to learn faster than anyone else

Community

Email Notifications

News

  • Addicted to Refactor! Pro

I read...

I Use...

Tags

Recent Posts

Archives

Blog Subscription Form

  • Email Notifications
    Go

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

<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.

Comments

TrackBack said:

# January 12, 2005 5:29 AM

Dennis van der Stelt said:

Okay, it seems after a lot of copy-n-paste some < characters were missing. And according to Kaisa, the word "site" was missing in the google url, so I added these as well...

Should work now like a charm. :)
# January 12, 2005 12:17 PM

Dennis van der Stelt said:

Just to inform the people who have implemented it already: The post is edited with some extra tweaks such as escape and 'site:'

I'm happy to see how many people find it usefull and easy to implement :)
# January 12, 2005 12:29 PM

Dennis van der Stelt said:

As it is here, thanks...
# January 12, 2005 1:03 PM

Dennis van der Stelt said:

Other info: I added an important notice to the post about Google terms and rumours about sites being removed from the index, please check it out and decide for yourself :)
# January 20, 2005 10:37 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 6 and 6 and type the answer here: