Spruce Up Your Search Results

May 15th, 07 | 5 remarks

Optimizing for the search engines is often at the forefront of every site owners’ mind, but what about the search on your own site? If you offer search functionality on your site (and I don’t know why you wouldn’t), why not add some “curbside appeal”, and really make it usable for your visitors? Small tweaks can make a big difference in helping your search stand out.

1) Clue users in

Give your readers a little clue about what keyphrase they just searched for by adding a simple statement like “your search for [whatever] returned the following:”.

<?php echo "Your search for <strong>" ."$s". "</strong> produced the following results..."; ?>

This is very useful if your reader performs more than one search. It gives an indication that the phrase they entered is actually the one that was searched for, and is returning relevant results. It’s particularly beneficial if you have closely related topics which might return similar results. Without a visual que, a user might think your search isn’t working properly if they aren’t seeing different returns.

You can also use CSS to style the keyword or phrase so it stands out even more with an eye-catching color, as with <em> or <strong> tags as shown in the example.

2) Show them more

Depending on the settings of your Reading tab preferences, you might only be showing your visitors one post per page. I prefer this approach to multiple posts, but unfortunately it affects search and archive listings as well. No one wants to search your vault one entry at a time. By using the Custom Query String plugin1, you can customize the number of results listings by a number of variables. Very handy.

Update: (9/28/07) With the release of 2.3, this plugin has now become obsolete, as it references a table in the database which no longer exists.

3) Open your pages

The default search provided by Wordpress only searches through your dated material. In other words, your posts. No Pages are included in that search unless you make use of the Search Everything plugin, which allows Pages and comments to be queried as well. A word of warning though… I’ve run into some trouble getting CQS and Search Everything to work together. Something about the combination (at least I think that’s the problem) seems to be disabling relevant results. What I mean is, the search works, but it produces the same results every time, no matter what you search for. If anyone has already experienced this problem and knows of a work-around I’d love to hear of it! :)

4) Cinch up your layout

If you don’t like the way the_excerpt() template tag works in Wordpress, you can tweak that a bit too, but using the following snippet in its place:

<?php the_content_rss('', TRUE, '', 50); ?>

Rather than having weird line breaks in your passage which the_excerpt() causes depending on your html, you can condense everything to display in one paragraph, and customize the number of words in your excerpt (represented by 50 above). This is nice for tightening up your search results and/or archive listings. I’m really bad about remembering to write in optional excerpts in my posts, so this works great for me.

5) Put your sidebar to work

I’ve seen a lot of bloggers monetize their search pages via contextual ads, which makes a lot of sense… but if you choose not to go that route you can still make good use of empty space by putting in other maintenance-free items such as related posts, popular posts, etc. This can help to guide visitors back into the funnel, so to speak. :)


1 The original author (drunkenmonkey.com) of CQS has announced that he has abandoned CQS, and is therefore no longer supporting it. You can however, still get it here on DA. I am not claiming ownership of, or offering support for this plugin. I’m merely making it available for download. It’s a great plugin.


  1. Tara

    The search box is a good idea, I think I will include one in my site when I redesign it. I am finding I don’t always know the best categorys to put a post in and this would definitely help.


  2. Charity

    Glad to be of some help Tara. :) From a user standpoint, I’m always a little surprised when there’s no search available on a blog. I can think of several occasions where I wanted to reference a post I remembered seeing on someone’s blog where there was no search available, and it’s frustrating. Pearsonified is a great example. Chris has such an awesome blog, with a ton of useful stuff, and yeah he’s using a sitemap, but my first instinct is to search, and I guess I’d just rather just have that option. :)


  3. WebStractions

    While your post deals with searching within the blog, there are also searches from outside referrers as well (eg: Google, Yahoo, MSN Search, etc.)

    A List Apart has a great tutorial on how to check the referrer against the search giants and highlight those terms on your page, as well as inserting the little blurb at the top of the page.

    Enhance Usability by Highlighting Search Terms

    I am sure this could be adapted for internal searches as well. The highlighting of the terms is extremely useful.

    [rant]Considering that this technique (originally conceived by WebMaster World) has been out there for 3 or more years and I have only seen it used on a minimal percentage of websites — mine included as well as many so called SEO sites. Oh well.[/rant]


  4. Charity

    Great tip Ronnie - thanks for pointing that article out. I think the idea of keyword highlighting is definitely worth looking into a little further. I often end up using Firefox’s ‘Find’ mechanism for highlighting specific words, but many people may forget about that or not be aware of it at all.


  5. WebStractions

    There is a highlighter on the Google bar as well. And if you type in words into the search box (without actually doing the search) you can highlight them on the page too. The advantage of using the Google bar to do it, is that they are multi-colored because it breaks individual words up. Firefox doesn’t.

Post your remark

Other Recent Articles

In Reviews »

Clever Development With Coda

07/15/08
If you follow design related blogs, it seems you can't click a mouse anymore without Coda's icon making an appearance. I heard about this software long before buying my Mac, but because it's exclusive to that platform, I was never able to give it a test run. Now eight ... [ » ]

In Inspiration »

Have You Ever?

06/25/08
If you know me very well, you know how important music is in my life. It's playing at all times in my house, and I embrace all kinds of genres. I don't talk about it much on this blog, but I should. Music and creativity, in my opinion, are inextricably ... [ » ]

In Design »

The Evolution of a Logo (I Can Live With)

06/19/08
One of the most frustrating things for me since I started writing on this blog was the lack of a logo I really loved. That's not to say I haven't tried. But logo design, to me, is kind of a thing all it's own and I'm just not very good ... [ » ]