Moveable Type Google Hack

| | Share

I've added a little hack onto the list of links beneath each post on this site: the "Google!" link will take you to a Google search of vaguely related items (depending on how well I composed the query for that entry.) Even if I didn't compose a specific query, it will attempt one based on the title of the post (as is the case with this one.)

It's not an original concept, but since it's neat and my particular implementation might be useful to other PHP/MT users, here's the relevant code:

| <a href="http://www.google.com/search?hl=en&q=<? if("<MTEntryExcerpt
encode_php="qq">") {
echo urlencode("<MTEntryExcerpt encode_php="qq">") ;
} else {
echo urlencode("<MTEntryTitle encode_php="qq">");
}; ?>">Google!</a>

Archives