iEntry 10th Anniversary RSS Contact


How Can My Google Site Search Just Look In A Subdirectory?

By: Dave Taylor
2008-01-04

Hi Dave. Maybe I've missed this somewhere, but how do I get the search to only look at one directory in my domain? I'm looking for it to only search files in my help file...

...but not to look in the rest of the site. I'm unsuccessful. I looked at that bot thing, and i didn't see an answer -cf how to add a Google search box to your site-

So, for example, it currently looks at www.mywebsite.com, but I want it to look at www.mywebsite.com/directoryA. Is there a way to do that? Entering that path simply returns 0 results.

This is a tricky problem, actually, because as you have noticed Google doesn't allow you to constrain searches to just a specific subdirectory on a site, even when you go directly to their search engine. A good way to see what you can and can't do, by the way, is to both check out the Advanced Search Page and the oh-so-helpful list of search operators.

Noodling on this, however, there are a couple of ways you could try to address the problem... :-)

First off, the operator intitle: is interesting. It lets you specify search results that contain a specific word or phrase in the title of the page. If your FAQ pages have a unique set of words in the title, perhaps "Help Pages", then you could try to use that constraint. For example, search for turkey dinner and look at the top four or five matches. Now search for turkey dinner intitle:recipe to see what I mean.

Even better, though, is if you have a specific subdirectory name, you can try using inurl: to constrain search results to just those matches in that area of your site. It's not foolproof, as a quick test with turkey dinner inurl:recipe reveals (that is, some of the matches are because the word appears in the filename, rather than as a subdirectory) but I imagine you can work around that by having a more complicated directory name. For example, instead of a potentially recurring word like "help" try "helpdir", which is unlikely to appear in the name of a file elsewhere on the site.

So that's a reasonable, workable search solution, one that will certainly let you do searches on Google itself for just that subset of files you desire.

How do you implement it as part of the search box? That's a bit more tricky because we have to splice together two strings in the Javascript (or pre-load "inurl:helpdir" into the text field, a potentially easier solution). That's something I'll address tomorrow, then come back and add a link to that article here. Stay tuned!

Comments

Tag:

Add to Del.icio.us | Digg | Reddit | Furl

Have a bookmark! -


About the Author:
Dave Taylor has been involved with the Internet since 1980 and is internationally known as an expert on both business and technology issues. Holder of an MSEd and MBA, author of twenty books and founder of four startups, he also runs a strategic marketing company and consults with firms seeking the best approach to working with weblogs and social networks. Dave is an award-winning speaker and frequent guest on radio and podcast programs.

AskDaveTaylor.com
http://www.intuitive.com/blog/


Visit the SearchNewz Directory
Do you have a search site?
Submit it free to the internet's best search industry directory. » Click Here
Search Engines
Google, Yahoo, MSN...

Search Marketing
Marketing, Budget, Planning...

Pay Per Click
Bid, Price, Quality...
SEO Companies
Optimization, Manage, Company...

SEO Tools
Track, Search, Create...

Analytics
Statistics, Counter...
» Submit your site for FREE «

Latest News

Get Your Site Submitted for Free in the World's Largest B2B Directory!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions



Titan Quest Forum Nintendo Wii Graphics Forum
Halo 3 Forum Mac Software

Privacy Policy Legal Sitemap Contact Us RSS Feeds Newsletter Archive SearchNewz.com Privacy Policy Legal Sitemap Contact Us RSS Feeds Newsletter Signup Subscribe to our feeds!