IT IS HERE! Get Smashing Node.JS on Amazon Kindle today!
Show Posts
← Back to homepage

Google Webmaster Tools has a very interesting widget to improve the usefulness of your 404 pages with little or no effort. It brings something like “Did you mean?” for your URLs, suggests links like pages in a higher hierarchy, and adds a Google Search form.

Google 404 Webmaster Tool

First, include this snippet where you want the suggestions to appear. For WordPress blogs, this is typically the 404.php file in your themes folder ((The full path would be /wp-content/themes/yourtheme/404.php. Create it if it doesn’t exist)).

Optionally, edit its look and feel by extending this base stylesheet. Tip: you can hide, for example, the search box, by adding display: none to #goog-wm

    /* Widget content container */
   #goog-wm { }

    /* Heading for "Closest match" */
   #goog-wm h3.closest-match { }

    /* "Closest match" link */
   #goog-wm h3.closest-match a { }

    /* Heading for "Other things" */
   #goog-wm h3.other-things { }

    /* "Other things" list item */
   #goog-wm ul li { }

    /* Site search box */
   #goog-wm { }

    /* Search text input */
   #goog-wm-qt {}

    /* Search button */
   #goog-wm-sb { }

Then you’re done! Check mine out (deliberately wrong url) for an example.


mad though it sounds, your link to google, err, is 404’ing!! perhaps they should have implemented their own widget! dah..

Your thoughts?

About Guillermo Rauch:

CTO and co-founder of LearnBoost / Cloudup (acquired by Automattic in 2013). Argentine living in SF.