Trackbacks
Sometimes writing code is more fun than writing words.
Everything has been said before, but since nobody every listens we have to keep going back and beginning all over again.
Over the weekend, I implemented Trackbacks (at least I think I did). This is probably only of interest to other bloggers, but lots of blogging software supports trackbacks, so I figured mine should as well.
In a nutshell, trackbacks are a way of linking entries together across multiple blogs. All of the pages on this site now have a “TrackBack Ping URL”. For this page, it’s “http://norman.walsh.name/cgi-bin/trackback/007,016”. The pages also have the RDF-in-a-comment hack for autodiscovery.
I haven’t got any mechanism in place for “outbound” pings, but “inbound” pings to norman.walsh.name should work. Feel free to give it a whirl! Successful trackbacks will appear on the bottom of the page.
Please let me know if I seem to have botched it somehow.
Comments
Some pages allow both trackbacks and comments.
What made you do this? I've lived a trackback-free life so far and never really found them useful on other sites.
Good timing Norm - trackback DoS style attacks have just started appearing - see: http://golem.ph.utexas.edu/~distler/blog/archives/000294.html
I've found TB quite useful, especially on my own blog. Most of the time it's just from duplicate links, but not infrequently it's worth looking back - kind of self-filtered referrers.
How do you convert the URL-encoded bytes to characters when they don't come with encoding information?
(FWIW, Pingback doesn't require putting data in comments.)
Why? Because it was there. I mean, that's the honest answer. I did it because I thought it would be interesting to do it.
I was aware, as I did it, that I was adding support for a public API that was vulnerable to abuse. If it's abused, I'll add some sort of moderation or something. Or just pull the plug. Writing the code was the fun bit, after all.
Movable Type didn't autodiscover, but adding the address you gave to "URLs to Ping" looks like it worked.
Henri: badly, probably. :-(
I'll have to look into the encoding issue.
Autodiscovery didn't work? Hmm. Maybe it's a typo. Or maybe I don't understand TB. Clues welcome. The page looks like it has the right autodiscovery bits in it.
On the other hand, Pingback requires the server to implement an XML-RPC server, which seems like a ridiculously unweblike way to pass 2 URLs to a remote server.
Norman: When I attempted a test ping via autodiscovery, your server refused the connection. When I pinged the TB URL directly, it worked. Give you any ideas as to what may be happening?
Mark, I agree using XML-RPC for POSTing two URLs is silly. However, I think Pingback is otherwise better specified than Trackback and even the XML-RPC part is expressed clearly.
Not sure about Roger's connection troubles, but one thing that's going to trip you up with Movable Type is that it appears to me from the source to require that values in the RDF be enclosed in double-quotes, not single. It's not actually using an RDF parser, just some regexes.
/me ducks and runs for cover.
Oh, for Pete's sake...
Phil, Norman: Yup, same here. The connection failure was the result of the regex getting confused by the single quotes.
Ok, I've fixed that, for some definition of "fix". Anyway, the RDF now uses double quotes.
Fair warning, though, I really think I should make my own XHTML DTD using the Modularization framework and get the RDF out of the comment. Then you'll get the quote mark you get and I won't be doing anything to "fix" it.
Putting real data in comments is wrong.
Absolutely, positively. Please do. I tried my best when Trackback first came out, but my best wasn't nearly good enough. Then, the RDF-in-XHTML WG started down that path again, but for reasons I didn't quite follow, have now headed off toward having XSLT create RDF directly from the XHTML. I think it had to do with only being able to express part of the RDF validity in a DTD, but if you aren't trying to make embedding arbitrary RDF in XHTML possible, just to make embedding this one little bit something that the validator won't mind, it seems like it ought to be possible. And if you do the hard part, I'll be more than happy to submit a patch for MT to at least accept any sort of quoting, if not use a real parser (which probably gets into "Bob can't install Perl modules that need to be compiled, so we can't require XML::Foo or RDF::Bar" issues).
A document that mixes RDF with XHTML does not follow the rules of Appendix C and, therefore, it would be inappropriate to serve such a document as text/html. When such a document is served as application/xhtml+xml, it is likely to be parsed using a non-validating XML-processor, so DTD-based defaults won’t matter. So why bother with the DTD modules when the document tree parsed out of a DTDless document is as good as a document tree parsed out of a document that advertises a custom DTD?
BTW, with regexp hacks that “parse” “RDF” the choice of quotes is not the only point when the choice of syntactic sugar is significant. The choice of the namespace prefix matters, too…
Works a treat from Movable Type directly now.