Is there a Search function for a site?
I haven't seen any examples or found any mention in my WD 11+ for adding a Search function to the site. It seems that if Google can find a page with a particular keyword, there must be a way to add that Search option to the home page. Any help would be great.
Re: Is there a Search function for a site?
Re: Is there a Search function for a site?
In Designer Pro 11 there is a Google search widget under the design gallery in the other widget folder. Not sure if this widget is in WD 11 if not you can also go to Google's site https://cse.google.com/cse/ to sign up and get the code to add a search function for your site.
Here is a website that has code for Google, Bing or even Yahoo to setup a search box:
http://www.developerdrive.com/2012/0...-your-website/
You should be able to add this code to a place holder and have either one of these for your site.
Hope this helps
Ray
Re: Is there a Search function for a site?
Thank you both for the links. I've been testing them out but seems I'll need to wait until google indexes the site before it works. I also came across AddSearch.com, which seems ideal but very pricey. I tested out their search function which only took a few minutes to crawl and index my 10-page website. But it works like a charm in their limited-time demo.
As for the Google search, I'm assuming it will have ads, but will wait to find out.
Re: Is there a Search function for a site?
Well, I finally made some progress, but could use a tip from a programmer.
I put the search function at the top of my fan site, and it does work, but it works too well. It finds and returns every instance of the words even in the code. Which means that it will pull up pages with the term as a keyword or part of a menu option. If I enter "Spartacus" for instance, all the pages in my site get shown.
So what I get is the same as if I entered: site:stanleykubrick.website spartacus
But if I manually enter: site:stanleykubrick.website intitle:spartacus, which added the operator "intitle", it now gives me only pages with the word "Spartacus" as part of the title. That would work much better for my site. Is there some extra coding that I could add to my existing code to do that? The code I have now is:
<form method="get" action="http://www.google.com/search">
<div style="border:2px dotted black;padding:4px;width:15em;">
<table border="0" align="center" cellpadding="0">
<tr><td>
<input type="text" name="spartacus" size="25" style="color:#808080;"
maxlength="255" value="Google site search"
onfocus="if(this.value==this.defaultValue)this.val ue=''; this.style.color='black';" onblur="if(this.value=='')this.value=this.defaultV alue; "/>
<input type="submit" value="Go!" />
<input type="hidden" name="sitesearch" value="stanleykubrick.website" /></td></tr>
</table>
</div>
Thanks.
1 Attachment(s)
Re: Is there a Search function for a site?
Acorn came up with one a few years back. I am attaching a simple Xara .xar document that contains a placeholder that you can copy and paste onto your .web or .xar document. Just change the URL www.placitasartists.com link with your own site URL.
If you like it and use it, be sure to thank Acorn (moderator here).
Click on the link above to see the search in action. Do a search for Painting, or Priester and anything else.
Re: Is there a Search function for a site?
Unfortunately it didn't work either. All it changed was adding WWW in front of the site name, but which oddly gave me no results at all. I think I need the code to specify "intitle:" with the search term. But thanks for finding that alternative code.
Re: Is there a Search function for a site?
Here is the code that you would modify to get Gary's example to work as you need:
<script type="text/javascript">
//Enter domain of site to search.
var domain="http://stanleykubrick.website" //replace this with your site domain
function GoogleSiteSearch(cur){
cur.q.value="site:"+domain+" intitle:"+cur.searchTerm.value
}
</script>
<form action="http://www.google.com/search" method="get" target="_blank" onSubmit="GoogleSiteSearch(this)">
<p><br /> <!--replace [[...]] with your details -->
<input id="searchBox" name="searchTerm" type="text" style="width: 192px" /> <input type="submit" value="?" /></p>
<input name="q" type="hidden" />
</form>
I would probably add a drop-down box to force include specific operators in http://www.googleguide.com/advanced_...reference.html like intitle:, rather that hard-code it.
Acorn
Re: Is there a Search function for a site?
for those of who prefer Google not to track us too much, I would use;
<script type="text/javascript">
//Enter domain of site to search.
var domain="http://stanleykubrick.website" //replace this with your site domain
function SiteSearch(cur){
cur.q.value="site:"+domain+" intitle:"+cur.searchTerm.value
}
</script>
<form action="http://duckduckgo.com" method="get" target="_blank" onSubmit="SiteSearch(this)">
<p><br /> <!--replace [[...]] with your details -->
<input id="searchBox" name="searchTerm" type="text" style="width: 192px" /> <input type="submit" value="?" /></p>
<input name="q" type="hidden" />
</form>
Acorn
Re: Is there a Search function for a site?