OK, I'm convinced. I've been toying with Movable Type's new Google APIs, and I've created something new and really cool.With a 3-line hack to Movable Type's source code (gosh, I love having the source code to my software) I added a new function to its Google search capability - I can now do dynamic google searches on each and every one of the titles of my blog posts. What's that mean? Well, look down at the bottom of this blog entry. You'll see a line that starts, "Related Stories:" followed by 10 links. These links are created by a google search on the words in the title of this blog entry. The reason why I can do this is because Google has created a standardised way to automate queries to its search engine using a protocol called SOAP and the folks at Movable Type have created an interface that takes advantage of SOAP calls. All I needed to do was to add 3 lines of code to the Movable Type codebase to enable the capability seen in the "Related Stories" links below. In addition, those links get updated each time I post a story - In other words, as Google indexes my pages and others like them, new stories show up whenever I update the index page with a new entry. Additionally, I could run a regular task to automatically refresh my Google related stories links for all of my entries each night as well. If you're interested in the patch to the Movable Type codebase, I've included it below.
You can get the patch file at http://www.sifry.com/mt-googleapi.patch It is also included below:
+++ Context.pm Wed Jun 19 01:46:44 2002
@@ -1225,10 +1225,13 @@
sub _hdlr_google_search {
my($ctx, $args) = @_;
my $query;
+ my $title;
my $blog = $ctx->stash('blog');
if ($query = $args->{query}) {
} elsif (my $url = $args->{related}) {
$query = 'related:' . $url eq '1' ? $blog->site_url : $url;
+ } elsif ($title = $args->{title}) {
+ $query = _hdlr_entry_title($ctx);
} else {
return $ctx->error('You used