What Would Seth Godin Do – WordPress plugin patch

This patch can be applied to version 1.5 of WWSG – if You use other version, more recent, You need to change this by hand, using idea from this patch.

I do use WordPress on few sites and I like it. Well, it is not ideal, but it has very strong community, which makes WP perfect tool for blogging.

Community provided plugins are great, and one of them which I use on each site is What Would Seth Godin Do. This plugin shows each new visitor short message. Message invites to subscribe to RSS feed, or whatever else blog author will configure.

New visitors are recognized by cookies and message can be placed on the post beginning or end. Trouble strikes when You put this message ahead post and user does not support cookies. Then every time post will begin with If you’re new here, you may want to subscribe to my RSS feed. Thanks for visiting! in default WWSGD setup. So what, You ask? One of those users is Googlebot, and believe You don’t want him to see this.

Now (short) story time. I have setup 30 Day Trial blog to document my progress with different attempts on self improvement. Of course I have setup WWSGD and this time I was using message box before post. After few days I was checking if my site got indexed by Google and:

What Google see

What Does Google See - Can You Spot a Pattern?

My incentive to grab RSS feed has become main part of excerpt served by Google in search results. Not good. But. It is enough to skip this message for Googlebot and… We have simple patch:

Index: what_would_seth_godin_do.php
--- what_would_seth_godin_do.php        (revision 42)
+++ what_would_seth_godin_do.php        (working copy)
@@ -120,11 +120,16 @@

+//Skip Google bot - do not offer Google opportunity to sign to Your feed ;)
+function skip_this_user_agent() {
+       return 0 != preg_match( "/Googlebot/", $_SERVER['HTTP_USER_AGENT'] );
 function wwsgd_message_filter($content = '')
        global $wwsgd_visits, $wwsgd_settings, $wwsgd_messagedisplayed;

-       if ($wwsgd_messagedisplayed || is_feed())
+       if ($wwsgd_messagedisplayed || is_feed() || skip_this_user_agent() )
                return $content;

Of course it could check against more User Agent strings (Ask, Live.com, others?) but who cares :) It works for me:

And what does Google see now?

And what does Google see now?

To patch or not to patch?

Much better. If You do use this plugin I suggest You to patch WWSGD (of course in case You need some help with patching…).

TLabel – simple, smaller labels on Google Maps

If You use Google Maps API, probably You want to use smaller windows/labels on map than default infoWindow, which happens to be huge and bloated.

When I started Run-N-Share almost two years ago, I stumbled upon TLabel, minimalistic library for creating labels on Google Maps. It is abandoned project, but it still works with current API version (110a). However there are some issues with it. For example when You close label, and then move map or zoom in or out, there will be Java Script error. I have fixed recently this error for RNS, so if You are still using TLabel, here are some details.

When removeTLabel is called, DOM element representing label is destroyed, but handlers registered to refresh view after zoomend or moveend events does not get unregister. To fix it change lines with GEvent.bind in TLabel.prototype.initialize to:

    this.zoom_handler = GEvent.bind(a,"zoomend",this,function(){this.setPosition()});
    this.move_handler = GEvent.bind(a,"moveend",this,function(){this.setPosition()});

Then in GMap2.prototype.removeTLabel add at function begin:

    GEvent.removeListener (a.zoom_handler)
    GEvent.removeListener (a.move_handler)

Eventually – does anybody knows similar library to TLabel? Maybe it is time to switch?