Google CSE with maSnun.com

I have finally replaced WordPress’ default search engine with Google Custom Search Engine (CSE).

I previously used to use Google Custom Search engine in the past on my old Freewebs site. But today while exploring my adsense account, I decided to add a “Adsense for search” block to masnun.com. I created the search engine and put the code on masnun.com straightway while using the option to open search result in a new page. But soon I gathered some interest to add the search page right on masnun.com.

To display the search results on my site, I had to put two blocks of code. One for the search box, another for the result page. I am using wordpress. So, to copy my template I had to edit one of my themes page. I chose the search result page of my current theme. I removed the code for WordPress’ built in search functionality and put my Google CSE Search Result Page code.

But to display the search result template, I have to visit: http://masnun.com/?s=something

So, I added a hidden field with the name “s” and value “search” to the search box form. I set the form’s target to: http://masnun.com/. I then put the code for the search box on my right sidebar replacing my old search box. Now It was working.

But I was having problem with the right sidebar being over ridden by the search results. So I removed the following code:

<?php get_sidebar(); ?> . Removing it removed the sidebars. Only the header and the footer was visible to form the site template.

Now the only problem with the layout was that I had no margin on the left side. The results were looking odd. Not being an CSS wizard, I had to manage some margin with table. Here’s the code:

<table>
<tr><td>&nbsp;&npsp;</td>
<td>

The results page code here.

</td>
</tr>
</table>

 

Now that was fine.

The search engine is running. I expect ads to pop up in the results page soon. I wish Google would index my new entries time to time. That would make the search mechanism a great one for masnun.com.

UPDATE: I am really amazed to see that this post got indexed by Google within twenty minutes!! That’s why Google rocks! Love you Google?!

Tags: , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">