We all know that the iWeb blog comes with a built in search facility that only works if you host your site on a MobileMe account (thanks for that Apple!!), but what do you do if you are hosted with a different web host of your choosing? The answer is simple: we turn to the masters of search Google and/or Yahoo to help.
Before we start adding a search box to our site, I must explain that the technique laid out below will work much better once your site has been indexed (had the search spiders crawl all over it) by either Google or Yahoo. The reason for this is because, in basic terms, we are just adding plain ol’ Google or Yahoo to your site but adding some code in the background that will restrict the search to just your site (or whatever URL you use). Clever eh?
Let’s add the code.
So once you have opened iWeb to the page you want to add search to, insert a HTML Snippet.
Now all you have to do is decide which version of search do you want to use for your iWeb site, Google:
<form action="http://www.google.com/search" method="get"> <fieldset> <input type="hidden" name="sitesearch" value="YOUR URL GOES HERE" /> <input type="text" name="q" size="31" maxlength="255" value="" /> <input type="submit" value="Search" /> </fieldset> </form>
If you want to make the search field narrower or wider change the value of size=”31″ to a different number. Additionally, if you want to have a bit of text (such as ‘Type your phrase here’) enter it in between the empty speech marks at value=”” /> . (See image below.)
<form action="http://search.yahoo.com/search" method="get"> <fieldset> <input type="hidden" name="vs" value="YOUR URL GOES HERE" /> <input type="text" name="p" /> <input type="submit" value="Search" /> </fieldset> </form>
Copy and Paste your chosen code into the HTML Snippet. You will see on the third line down that there is a bit of text that says ‘YOUR URL GOES HERE’.
Obviously that is where you put your site’s web address, including the ‘http://’ bit; make sure you leave the quotation marks in too.
That is all there is too it. Just publish your site as normal to your server.
In the image below there are the 2 examples however I have added a shape to act as a border. I used ‘Inspector’ and it’s Image tab I set the fill to ‘none’ and changed the border to suit the iWeb site. You can customize it how ever you like.