This tutorial will show you step by step how to create a Google custom search engine for your Joomla site (and/or another site) in your Joomla site. This tutorial uses Joomla 1.5 but you can use exactly the same steps on Joomla 1.6.
Download
We are going to be using an excellent Joomla extension called googleSearch (CSE) component . Click here to go directly to the download page.
Download the extension of your respective Joomla version.
Install
Go to Extensions >> Install/Uninstall >> Browse... >> Upload File & Install
Set Up Custom Search Engine in Google
Click here to go to the Google Custom Search Engine Configuration page directly. Click on Create a Custom Search Engine.
The first step (1. Setup up your search engine) is self-explanatory. Configure appropriately.
The only tricky part is the syntax for the "Sites to search". In the example, I have it so that only results from www.ostraining.com and www.joomlatraining.com show up in the search.
Formatting your URLs
- Individual pages: Specifying www.mysite.com/mypage.html will just include the mypage.html page on www.mysite.com.
- Entire sites: Specifying www.mysite.com/* will include all the pages on www.mysite.com.
- Parts of sites: You can use wildcard patterns to include just certain parts of a site. For example, www.mysite.com/*about* will include only files on www.mysite.com that have about in their name.
- Entire domains: You can also specify an entire domain using *.mydomain.com. If you specify mydomain.com, we will automatically convert this to *.mydomain.com/*. If this is not what you want, you can change it back in the control panel.
Click Next when finished.
In the second step (2. Try it out) we only have to test the search engine to see if we correctly configured the URLs in step 1. There is no need to customize because we will do that in the Joomla administrator.
In the example screenshot above, I tested with the keywords "Joomla Training". The results only bring up results from www.ostraining.com and www.joomlatraining.com, which is what I wanted.
Test the search. If the results are not what you wanted, go back to step 1.
Click Next when finished.
Get the Custom Search Engine's unique identifier
The last thing we need is the Custom Search Engine's unique identifier. The easiest and less confusing approach for most people is to copy it from the control panel. Click here to go to the management area. Click on Control Panel.
Copy the unique ID.
Configure Joomla Component
Go to Components >> googleSearch (CSE)
Paste the ID in the Custom Search Engine's unique identifier field.
The custom the rest according to your preferences.
Save.
Create the Menu Item
Finally we need to create the menu item. Go to Menus >> Your menu
Click on New.
Click on googleSearch (CSE)
Configure appropriately. Give it at least a Title and then Save.
Test
Go to the menu item in the front end and test your search.