TrackBack Specification
DESCRIPTION
The standalone TrackBack tool serves two purposes: 1) it allows non-Movable Type users to use TrackBack with the tool of their choice, provided they meet the installation requirements; 2) it serves as a reference point to aid developers in implementing TrackBack in their own systems. This tool is a single CGI script that accepts TrackBack pings through HTTP requests, stores the pings locally in the filesystem, and can return a list of pings either in RSS or in a browser-viewable format. It can also be used to send pings to other sites.
It is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html.
REQUIREMENTS
You’ll need a webserver capable of running CGI scripts (this means, for example, that this won’t work with BlogSpot-hosted blogs). You’ll also need perl, and the following Perl modules:
The first four are core modules as of perl 5.6.0, I believe, and LWP is installed on most hosts. Furthermore LWP is only required if you wish to send TrackBack pings.
INSTALLATION
Installation of the standalone TrackBack tool is very simple. It’s just one CGI script, tb.cgi, along with two text files that define the header and footer HTML for the public list of TrackBack pings.
- Configure tb.cgi
You’ll need to edit the script to change the $DataDir, $RSSDir, and $Password settings.BE SURE TO CHANGE THE $Password BEFORE INSTALLING THE TOOL.
$DataDir is the path to the directory where the TrackBack data files will be stored; $RSSDir is the path to the directory where the static RSS files will be generated; $Password is your secret password that will allow you to delete TrackBack pings, when logged in.
After setting $DataDir and $RSSDir, you’ll need to create both of these directories and make them writeable by the user running the CGI scripts. In most cases, this means that you must set the permissions on these directories to 777.
- Upload Files
After editing the settings, upload tb.cgi, header.txt, and footer.txt in ASCII mode to your webserver into a directory where you can run CGI scripts. Set the permissions on tb.cgi to 755.
USAGE
Sending Pings
To send pings from the tool, go to the following URL:
http://yourserver.com/cgi-bin/tb.cgi?_mode=sendform
where http://yourserver.com/cgi-bin/tb.cgi is the URL where you installed tb.cgi. Fill out the fields in the form, then press Send.
Receiving Pings
To use the tool in your existing pages, you’ll need to do two things:
- Link to TrackBack listing
First, you’ll need to add a link to each of your weblog entries with a link to the list of TrackBack pings for that entry. You can do this by adding the following HTML to your template:<a href="http://yourserver.com/cgi-bin/tb.cgi?__mode=list&tb_id=[TrackBack ID]" onclick="window.open(this.href, 'trackback', 'width=480,height=480,scrollbars=yes,status=yes'); return false">TrackBack</a>
You’ll need to change
http://yourserver.com/cgi-bin/tb.cgi
to the proper URL for tb.cgi on your server. And, depending on the weblogging tool that you use, you’ll need to change[TrackBack ID]
to a unique post ID. See the conversion table below to determine the proper tag to use for the tool that you use, to generate a unique post ID. - Add RDF
TrackBack uses RDF embedded within your web page to auto-discover TrackBack-enabled entries on your pages. It also uses this information when building a threaded list of a cross-weblog “discussion”. For these purposes, it is useful to embed the RDF into your page.Add the following to your weblog template so that it is displayed for each of the entries on your page:
<!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> <rdf:Description rdf:about="[Entry Permalink]" dc:title="[Entry Title]" dc:identifier="[Entry Permalink]" /> trackback:ping="http://yourserver.com/cgi-bin/tb.cgi/[TrackBack ID]" </rdf:RDF> -->
As above, the tags that you should use for
[TrackBack ID]
,[Entry Title]
, and[Entry Permalink]
all depend on the weblogging tool that you are using. See the conversion table below.
Conversion Table
- Blogger
TrackBack ID =<$BlogItemNumber$>
Entry Title =
<PostSubject><$BlogItemSubject$></PostSubject>
Entry Permalink =
<$BlogItemArchiveFileName$>#<$BlogItemNumber$>
- GreyMatter
TrackBack ID =
{{entrynumber}}
Entry Title =
{{entrysubject}}
Entry Permalink =
{{pagelink}}
- b2
TrackBack ID =
<?php the_ID() ?>
Entry Title =
<?php the_title() ?>
Entry Permalink =
<?php permalink_link() ?>
- pMachine
TrackBack ID =
%%id%%
Entry Title =
%%title%%
Entry Permalink =
%%comment_permalink%%
- Bloxsom
TrackBack ID =
$fn
Entry Title =
$title
Entry Permalink =
$url/$yr/$mo/$da#$fn
Thanks to Rael for this list of conversions.
POSSIBLE USES
- Content repository
Like Movable Type’s TrackBack implementation, this standalone script can be used to power a distributed content repository. The value of the tb_id parameter does not necessarily have to be an integer, because all it is used for is a filename (note that this is not true of most other TrackBack implementations). For example, if you run a site about cats, and want to have a way for users to ping your site with entries they write about their own cats, you could set up a TrackBack URL like http://www.foo.com/bar/tb.cgi?tb_id=cats, then give that URL out on your site. End users could then associate this URL with a Cats category in their own blog, and ping you whenever they wrote about cats. - Building block
You can use this simple implementation as a building block, or a guide, for implementing TrackBack in your own system. It illustrates the core functionality of the TrackBack framework, onto which you could add bells and whistles (IP banning, password-protected TrackBacks, etc).
- Centralized tool
This TrackBack tool requires that the end user have the ability to run CGI scripts on their server. For many users (eg BlogSpot users), this is not an option. For such users, a centralized system (based on this tool, perhaps) would be ideal.