Validate this!
You know how when you were a kid, and you had to clean your room on a sunny day when you would rather be outside, so you just cleaned it by stuffing everything under the bed or in the closet, where Mom wouldn’t see it? After all, if she doesn’t see it, she doesn’t have a problem with it. That’s my new approach to validating the TrackBack RDF data.
We need the RDF to be available in two ways: it has to be available to Javascript, so that the bookmarklet can pick it up and let you automatically add a ping while posting, and for future development, it should be available to programs that might come trolling for it. I doubt that anyone is crazy enough to write a program that extracts it by trying to run (X)HTML pages through an XML parser, so at least until nobody ever publishes anything but completely valid XML, it only really needs to be accessible to a regular expression matching the source. So, as a stopgap measure until we can come up with something better, there’s <$MTEntryTrackbackScriptData$>, which produces RDF inside a series of Javascript document.writes. Stop laughing. The code is really ugly, since I don’t really get Perl, so if someone wants to clean it up I’d be happy to see version 2, but this does work.
First, click your TrackBack enabled bookmarklet on this page, and note that it finds TrackBack urls to ping. Then, scroll down to the bottom of the sidebar, and click the XHTML 1.0 icon, and verify that this page validates. Then, download EntryTrackbackScriptData.zip and unzip it. If you don’t already have a plugins directory in your mt directory (the plugins directory should be in the same directory with mt.cgi), create it, and then upload EntryTrackbackScriptData.pl to the plugins directory. Replace <$MTEntryTrackbackData$> with <$MTEntryTrackbackScriptData$> in your templates, and rebuild. If all that DTD writing didn’t fry my brain, you should have working TrackBack data that’s hidden from the validator. Programmers whose regexp will have to match a ‘); at the end of every line: I’m sorry. It’s the best thing I can come up with, for now.
Thats a pretty cool idea. I’m actually using it on my site right now. I would prefer the RDF data working as is, but atleast this is validating :)
How do you get the referrals to show up on your page? I’ve been trying to get similar code to work and just can’t seem to do it. Will you share your secret?
It’s brutally ugly code, since I threw it together in hurry to see if I’d like it, thinking I’d clean it up later. Wrong. But, if you want it, it’s yours. Unless I forgot something, the only things you should need to change are in the template module, $backlink_dir (be sure it’s chmodded 777), $blacklist (so you don’t refer yourself), and $my_email. Desperately in need of some work, since among other things it doesn’t try to figure out the permalink for the referrer, so an MT blog with category, date, and individual archives will send you four (or more) different urls.
Great!
Now all we need is an easy way to make MT 2.21 do XHTML 1.1 without breaking the archive links (i.e.
s/<a name="/<a id="/
)Validation
Phil Ringnalda has come up with a way around the RDF and XHTML validation issue. Its a new plugin for
TrackBack
Learn more about TrackBack Development. It’s a new system for MoveableType blogs, but it’s not just limited to this blogging
Validate this!™
Thansk to Phil Ringnalda, this page now validates AND works with MT’s TrackBack.
Third (and final?) idea for TrackBack and XHTML validation
I certainly hope that this is my final proposal for dealing with the fact that the RDF that TrackBack inserts