Paul Makepeace ;-)

October 4, 2004

Movable Type URL redirection

Posted in: Movable Type

Movable Type 2.661 has a "feature" that shrouds an author's URL behind a redirect in the hopes of reducing the google-juicing effect of comment spammers being linked to during their nefarious activities.

There are several problems with this, see this excellent breakdown. Most importantly, any halfway competent MT installation will have some software to manage the comment spam, like MT-Blacklist. So the whole annoying redirect "feature" is redundant when you have no comment spam.

But there's no way to turn it off in 2.661, and I haven't found a patch for it, so I have just written one which also corrects a few bugs I found in MT::Template::Context.


Features:
* Turns off URL redirection by default (do a Rebuild to pick up changes)
* To turn it back on add the redirect_url="1" to MTCommentAuthorLink and MTEntryAuthorLink references
* If you do want redirection, the anchor contains a title attribute so you can mouseover it and at least see where you're going

Fixes:
* Known bug in 2.661 (in fact due to the URL redirection!) where during a comment preview an error appears, MT::App::Comments=HASH(0xdeadbeef) Use of uninitialized value in sprintf at lib/MT/Template/Context.pm line 1187.

Here's the patch or complete lib/MT/Template/Context.pm file. If someone would like to contribute an updated mtmanual_tags.html I'll include it.

I was seriously tempted to make the show_email default to 0. You may like to do this. It's quite obvious where this is in the code.

If you wanna look leet, roll your installation's version number in MT.pm :-)

PS It's quite late at night and this code isn't heavily tested. Seems to work though...

Posted by Paul Makepeace at October 4, 2004 01:24 | TrackBack
Comments

Have you seen the Optional Redirect plugin? ;)

With 3.x, Movable Type added a "no_redirect" attribute, and also shows the URL as the title of the link.

Posted by: girlie at October 4, 2004 03:56

Girlie - thanks, I found that after I got the patch working. C'est la vie! To be honest, I'm not one of the MT cognescenti so if my googling shows up nothing I just start hacking...

Still, on top of the title tweak, my patch also fixes other errors in the code. Like this from the original,

my $show_email = 1 unless exists $args->{show_email};

Anyone familiar with some pretty obscure perl will know this bit of code is not doing what it appears.

MT 3.x - yeah, one day :)

Posted by: Paul Makepeace at October 4, 2004 04:13

Hey, I'm still using the old 2.661 and I was getting that annoying error in the preview comments page. Used your hacked context.pm and now it's gone, so thanks man! :)

Posted by: Fungii at January 20, 2005 05:59
Post a comment









Remember personal info?