Add Google Custom Search to Your Blog in Less Than 10 Minutes!

October 19, 2010 — 123 Comments

[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series.]

[tentblogger-vimeo 15994787]

***UPDATE – The above video is out of date since the iFrame system that Google CSE used to use is now old and deprecated. I have added a visual walk-through at the end of this post for a most up-to-date version!***

[Like the quality of the screencast? I use the Screenflow app for it!]

Challenge Type: Feature, Functionality
Time Required: 10-15 minutes
Impact: Big! Google’s CSE is awesome. Period. Not to mention that having a Search Box is a good idea anyway! And honestly, why not have the most powerful search engine technology powering your search on your blog?

Have you ever wanted to add a really robust search engine to your own blog? You can do that easily with Google’s Custom Search Engine Tool!

In fact, the video above walks you through that entire process in less than 10 minutes!

Here are some additional things to take note of:

  1. I’m using WordPress. Here’s why.
  2. I use CSE (Custom Search Engine) because it’s easy to create and setup, familiar to the end user, and the results are very relevant and valuable.
  3. You can style the look easily!

Pretty sweet, right?

Let me know if you’ve accepted the challenge and then link to your site with the new search engine!

[Interested in more thoughts about CSE? I wrote a post here about another option and performance issues as well as a tip on how to create a "Network-Wide Google Custom Search Engine". Sweet!]

Finally, I thought I’d share the reason why it would be best to pay for your CSE ($100.00 per year) if you can justify the cost at some point. Your goal, as much as you can control it, is to keep your visitors on your blog.

By having advertisements on the search results you give them “escape routes” to other content. One might argue that it pays you if they do but I’m of the camp where I’d rather they stay on my property and find value here, thus endearing them to my content and the community here, which I think pays off in the longer run.

Updated: Visual Walkthrough for Installing Google CSE

As I mentioned above the video is outdated and I didn’t have the time to make a new one – but I captured the process visually for your use!

It’s quite simple and here are the steps:

Head over to Google’s CSE Tool and click Create a Custom Search Engine.

Time to get started!

On the left you’ll see an option to start the creation of a New Search Engine – feel free to click that!

You might have some other search engines listed here as you build out other blogs that you’re working on. On a sidenote I think that Google CSE is a fairly complete solution and would recommend it for most blogs, depending on their unique needs of course.

The choice is up to you! There are definitely some other alternatives but none as robust as this option in my humble opinion.

The next step is to fill out the specifics of your Google CSE. You’ll want to input a name, description, and then the domain.

Just one blog to search or more than one?

For the Sites to search: area you’ll just want to start with your one blog – as you can see you can input more than one if you wish! But let’s start simple, shall we?

Click next and then next again and then find the Change Look and Feel button to get to the good stuff:

Nothing here for you right now...

There we go!

On the next page you’ll want to choose Two Page as the format and then style it as you wish. I recommend not doing anything for now – you can customize the design and style a bit later after you set it up.

Almost there...

Now you’ll have to enter the Search Results page that you’ve created in WordPress:

As you can see I created a WordPress page here on TentBlogger called “Search Results” with the post slug of /search-results/ – make sure you get this right as it won’t work otherwise!

You can even add your Google Analytics code in there to provide even more tracking for your Google CSE if you wish. I do have this in place for metrics and advanced analytics if you were wondering.

Finally, grab the code! You’ll want to put in a Text Widget the information in the first box and then the second set of code in your WordPress’ page:

A nice simple text widget.

And…

WordPress Page called "Search Result" with the post slug of /search-results

Then that’s it!

You’ll want to test, of course (and it might take a second, especially on a new blog that might not have been indexed yet):

So pretty! So usable! So... Google!

And that’s it!

You’ve done it – congrats! Let me know if you have any questions.

[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series. Check out the rest here!]

John

Posts Twitter Facebook

I'm passionate about startups, blogging, and human capital. I love what I do and who I get to work with. I am incredibly blessed.


123 responses to Add Google Custom Search to Your Blog in Less Than 10 Minutes!

  1. Going to implement this on the radio station site that I manage. Very nice! FREE is awesome too!

  2. Tried it. Every time I tried to paste the code into my sidebar widget, it deleted everything between the ‘s. Will try again later.

  3. I was just about the ask in the forum boards how to do this. Will try to work on it soon!

  4. Fantastic tutorial on adding the search box and page. I have done this before but haven’t done it for WordPress so this will definitely come in handy. Thanks for making this!

  5. I’m curious, why would you use Google search instead of just using the built-in search capabilities of WordPress? The WordPress search is free, already built-in to your site, has no ads, and the search results are fully customizable as part of your WordPress theme. Could you talk about some of the cons with native WordPress search?

    • John Saddington October 19, 2010 at 3:26 PM

      Ben,

      it simply isn’t that good out of the box. It’s been noted by the community at large that it might just be one of the weakest features that wordpress has to offer. there are ways to improve it though (see here).

      it generally does need to be improved.

  6. and so the next question is, “is this a better option than the already-super-awesome Standard Theme search?”

    by the way, i haven’t commented over here before, but i’m really digging the premise of this site John. thanks for going with your gut on this one…

    • John Saddington October 19, 2010 at 3:37 PM

      yes. or i’d be using it, right?
      ;)

      the standardtheme search is built off of wordpress’s… … perhaps i need to look into making that better….?

  7. Done.
    I noticed since transitioning to the Standard Theme (best theme ever!) my width was off on my results page. So instead of just changing the px width I though I would just follow along with your tutorial.
    Good stuff. Thanks for all the shared wisdom.

  8. oh well. this doesn’t like me too much. it just kicks the search by to my home page with a mess in the url.

    how did i mess this one up?

  9. Thanks for the post, John. I just added this to http://www.dustinsams.com, a friend of mines blog that I help maintain.

    This search feature is already WAY better than the original.

  10. I’d watch that video but my university doesn’t like it: http://bit.ly/brNCBV LOL.

  11. Awesome. It’s now on my site. I will have to mess with the colors a little bit.

  12. Trying it out as a widget. Didn’t style it, I may do that later if I decide it’s a keeper there.

    I’ll definitely put it somewhere.

    http://www.freshroastcreative.com/blog/

  13. Is there any way to style it, I like the style of my current search box, you add this and it looks terribly plain and standard :-(

  14. Hey John! we can do the same thing but with Google Adsense. Have you tried that?
    Thanks for the video.

  15. Nothing can beat WordPress but it’s search function is not that good. So I switched to Google Custom Search few months ago… It’s superb…

  16. So, question. On the free version, do you get paid for clicks on the ads?

  17. Thanks…working on mine now after your vid

  18. John – in Std Theme 2, is not a Google CSE?

  19. Great Tutorial – I just did it on my blog & it works great. Thanks.

  20. John, I feel guilty not commenting on your post, thanks again, your blogs help! :)
    Psst- u shud consider taking offerings after each posts of urs :) :p lol great content.

  21. It doesn’t look like you are using Google CSE…..

  22. It looks like the site has to get indexed before the search works???

  23. Awesome. I just set it up. I like how the search results show up on the side bar too.

    http://www.randrambles.com

    Thanks!

  24. So easy! Thanks John. I just added Google CSE to my sidebar via a widget.

    When the designer is finished with the site, I’m sure it’ll look awesome. :)

  25. How do you monitor your GSE stats — just go to GSE site or do you use something else?

  26. Boom. Setup. Thanks.
    Google has changed their options a little from the time of your video tutorial, but I found my way around.

    Now to figure out how to style the darn “search” button. http://www.joinsomethingbig.org

  27. Finally found ten minutes to spare and got this taken care of. I had a little difficulty since they’ve changed some things since your video posted, but I think I have it working right. Check it out http://www.smalltownkidmin.com.

  28. ALL: I updated this blog post with a visual walkthrough… thanks for those that mentioned it had changed…!

    :)

  29. Just did this on my blog. Thanks! :)
    Also made a cuter 404 page today at your suggestion as well!

  30. When would you recommend adding Google’s CSE to a site?

    Using CSE wouldn’t be any good for a new site with limited content would it? Or does adding CSE mean your site becomes indexed more regularly by Google?

  31. Yay, put it in on my new blog. Seems that I have not been indexed yet.

  32. Is Google custom search increases blogs earning….??

  33. Is there a way to add this google search box to to a search link in our navigation (Home/Blog/Port/Etc/Search) header?

    Wonderful post again man!

  34. Great posting! After deleting “empty lines” it finally works. Thanks a lot. Is there a way to exclude file-permalink from search-results to make it clean? Or just “depth=1″ (excluding subdirectories) in results?

  35. I got everything installed, the search-results page created, but if I do a search, I just get the page that opens up and says “loading”

    I know that google has to index the site, but how long should that take?

  36. Hi John — I have a question for you — my blog is running on your Standard Theme that I purchased — I just do not know how to create the following to make this Google search work: “As you can see I created a WordPress page here on TentBlogger called “Search Results” with the post slug of /search-results/ – make sure you get this right as it won’t work otherwise!”

    How do I create that page? Also, I think when I was messing around with the search.php file on the Standard Theme, I deleted the original file info that was there — can you just send me or comment here the original code — and then how I can create that search page? Thank you so much for your help in advance!

    • ah. the newest standard theme has this built-in. have you checked out the support forums too?

      • Ok got it — I have not checked the forums because I do not think I bought the license to access them — but your new theme is really cool so I will just buy it, upgrade to it and the issue should be resolved automatically — I am very amateur when it comes to coding etc, I just know how to write lol :)

Leave a Reply