When I implemented Trackback support here, one snag I ran up against is that I typically post to my website via the MetaWeblog API (using the very cool w.Bloggar client app), and the blog posting APIs don’t provide any inherent way to provide Trackback URLs. Nor should they, as that doesn’t really fall under the API’s core functionality. However, it still seemed wasteful to have to set up a separate web form just for doing Trackbacks. So here’s what I did….
In the server code that handles the client APIs for my blogging software, I added a snippet of code just after where a new entry is actually posted into my blog. The code snippet searches the incoming blog entry for an HTML comment that looks like:
<!-- trackback url=http://www.example.com/tb.cgi/987 -->
If it sees comment like that, the code extracts the Trackback URL and posts a Trackback ping to it. Voila! A tiny amount of work, and now I can go back to being moderately lazy. All I have to do is remember to put the Trackback URL in an appropriately formatted comment, and my server will automagically let the site know that I’ve linked to them.
I’d like to encourage anyone else involved in coding other blogging systems to do the same, if your software supports one of the blogging APIs (BloggerAPI, MetaWeblog API, etc) and Trackbacks.
Trackback vs MetaWeblog APIRelated posts:
- New Features
" I worked on a couple of new features for this blog over the past couple of weeks. The first is an About Page, with..." - Pingback Added
" I’ve hacked together support for Pingbacks. There are pros and cons to Trackback and Pingback. Pingback is more automated. Trackback has wider support because..." - The Conversational Web
" A lot of blog development of late has been directed towards establishing connections between multiple weblogs via mechanisms such as Trackback, Pingback, and friends...." - WordPress 0.72 is out
" After a flurry of minor bug fixes, WordPress 0.72 is released. Don’t let the tiny version number change fool you — there is lots..." - Update on WordPress blog APIs
"I mentioned previously that the XML-RPC and Atom blog APIs would be disabled by default when WordPress 2.6 is released. This was a matter of..."














10 Comments
Here’s a method I proposed, that is much easier for the user since it’s totally transparent.
Once the client app has posted an entry, it’s receiving a post ID (according to the Blogger API). Make a new method myblog.getPermalinkFromID, let the client app use it to get the permalink of the newly created entry.
From here on, the client app can do the trackback/pingback work itself just fine.
(For the Trackback work, I assume the client can do trackback autodiscovery, which has a very poor design and therefore may slow down the app more than Pingback would… but that’s not the topic here.)
I haven’t implemented Trackback autodiscovery, yet. So I was looking for an interim solution that would be nice and generic.
I’m working on Pingback support now, and since it uses autodiscovery as a core part of the spec, I should be able to carry over some of what I learn there back into my Trackback code.
I assume you are setting up a way to ping the site to which your blog entry refers. If so, you probably also want to send other cool info in the ping like the URL of your entry (this is required, right?), the title of your post, and excerpt of the post, and the title of your blog. How are you doing this now? does your internal API grep this info from your post and then pass it with the ping?
When I post via the MetaWeblog API, all of that information is available. The client program sends the post’s title and content. When the post is saved into the database, the post’s ID is returned, and I can build the permalink from that. So I’ve got all of the essential info to send in the Trackback ping.
So your comment entry is a way to instruct your server API to compose a valid message to ping the URL in the comment, right?
how about changing the comment format slightly to set it apart from any other comments that might look like a trackback?
something like <!–%%trackBackUrl=”…”–>
Yes, the comment just gives me a way to supply the Trackback URL, since the client program doesn’t have a dedicated way to enter it.
Why would I need to change the format? As it is, I never include any HTML comments in a post for any other purposes. And the format I’m currently using is very specific, so it’s unlikely that I’d forget and trigger it accidentally.
just thought that, if you wanted to do it in a way that would encourage others to also implement the same kind of feature, that using a more unique pattern for the comment wrapper would make it easier for other tools to deal with the item. If the idea is really just a way to make your own back end work, then it doesn’t matter at all.
just thought that, if you wanted to do it in a way that would encourage others to also implement the same kind of feature, that using a more unique pattern for the comment wrapper would make it easier for other tools to deal with the item. If the idea is really just a way to make your own back end work, then it doesn’t matter at all.
This is a good idea. However, I’d like to see the blogging applications (w.bloggar and the like) support trackback/pingback natively. This can be done so many different ways, all of which are fine with me. The client can visit the links in the post looking for TrackBack auto-discovery and pinging them (or asking the user if it should do so) as needed. Additionally, a trackback field in the client could handle this for those that don’t support auto-discovery. I agree with you, however, that the metaweblogAPI should not be changed to support this. It just doesn’t fit.
I’d certainly be happy with a client-based solution, as well. w.Bloggar already has native support for pinging weblogs.com, so Pingback and such probably wouldn’t be that much more to add.
One Trackback
Pizza Review Blog…
Pizza Review…