Movable Type User Manual: TRACKBACK

« Table of Contents


TRACKBACK

Movable Type's TrackBack system allows peer-to-peer communication and conversations between weblogs. Imagine that you write about a movie you just saw in an entry on your Movable Type-powered weblog. Another MT weblogger reads your entry, and wants to write an entry referencing your original post. He could just comment on your weblog, but he'd like to keep the post in his own database and host it on his site.

Using TrackBack, the other weblogger can automatically send a ping to your weblog, indicating that he has written an entry referencing your original post. This accomplishes two things:

  1. On your site, you can automatically list all sites that have referenced a particular post, allowing visitors to your site to read the response on the other user's weblog.

  2. It provides a firm, explicit link between his entry and yours, as opposed to an implicit link (like a referrer log) that depends upon outside action (someone clicking on the link to your entry).

You can use TrackBack for more than just communication on particular entries, however. You can also associate TrackBack pings URLs with categories in your weblog. Whenever you post an entry to that category, the URLs you have associated will automatically be notified of your post. This allows remote sites to keep a repository of references to posts all around the web.

For example, if you run a site about Perl, you might want to provide a repository of links to Perl articles on other weblogs. Using TrackBack, you can allow other weblogs to ping a particular category in your own weblog, whenever a new entry is posted that pertains to this category.

These are just examples of TrackBack usage. TrackBack itself is a framework for peer-to-peer communication between weblogs; it can track cross-weblog discussions, it can provide remote content repositories, it can emulate guest authoring, etc. The technical side of TrackBack is very simple: when you want to notify a remote site of your existence, you send a ping to that site. The format of these pings (simple HTTP GET requests) is discussed below. In the Movable Type implementation of TrackBack, we've added password protection to category pings, IP banning, automatic RSS output, and email notification of new pings.

In other words: we want TrackBack to benefit, and to be useful to, more than just Movable Type users. We want to encourage integration of this feature into other weblog tools; that's why we have documented the ping format below and have tried to make the basic framework very simple. Feel free to email us (trackback@movabletype.org) if you have questions.

Setting up TrackBack

If you are a new Movable Type user, the TrackBack tags are included in the default templates, so you are ready to use it as soon as you install Movable Type. You can skip down to Step 5.

If you are an existing MT user, you'll first need to set up your templates to handle TrackBack pings. Start at Step 1.

  1. Create a TrackBack Listing template.
    In List Templates, edit the TrackBack Listing template and initialize it with the template body from the default templates. You can find that here:
    http://www.movabletype.org/default_templates.shtml#trackback
    

  2. Update your stylesheet.
    An entry's TrackBack pings are displayed in a popup window similar to that used for listing an entry's comments. The default template that you added in Step 1 uses some CSS styles new to version 2.2. If you are using one of the default styles provided with Movable Type, copy and paste in the updated version from the styles here:
    http://www.movabletype.org/default_styles.shtml
    

    If you have a custom stylesheet, you can either customize the TrackBack Listing Template to match your site's styles, or add new CSS styles to your stylesheet for the classes .trackback-url, .trackback-body, and .trackback-post.

  3. Add TrackBack code to your Main Index Template.
    Add the following code in the <script> section of your Main Index Template:
    function OpenTrackback (c) {
        window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,status=yes');
    }
    

    Now, inside of your <MTEntries> tag, add the following code to display a link to the TrackBack listings for each entry:

    <MTEntryIfAllowPings>
    | <a href="<$MTCGIPath$>mt-tb.cgi?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack
    (<$MTEntryTrackbackCount$>)</a>
    </MTEntryIfAllowPings>
    

  4. Add TrackBack ping data to index and archive templates.
    In your Main Index Template and in your category and date-based archive templates, add the following tag directly after the main <MTEntries> tag:
    <$MTEntryTrackbackData$>
    

    Then, in your Individual Entry Archive Template, add this same tag anywhere in the template:

    <$MTEntryTrackbackData$>
    

    When you rebuild, this will add the necessary information to your public files to allow Movable Type's bookmarklet to parse out entries that allow TrackBack and to grab the ping URL for those entries.

  5. Create a TrackBack-enabled bookmarklet.
    A TrackBack-enabled bookmarklet is just a new version of the standard Movable Type bookmarklet, with one new feature: when you use the bookmarklet to post to your weblog, it will look at the current page in your browser to see if it has any entries that have enabled TrackBack. (It obtains this information using the tag we added in Step 4). If there are any entries, the bookmarklet will allow you to select from the list of TrackBack-enabled entries on that page that you can ping with your new post. When you post your new entry, Movable Type will ping the URL for the appropriate entry automatically, just as if you had entered the URL manually into the URLs to Ping box.

    This simplifies the process of referencing a post on another site using TrackBack.

    If you are already using a bookmarklet, you will just need to recreate it using the same fields you are using now, plus the TrackBack items field. If you are not yet using a bookmarklet, you can create one.

    Go to the Main menu, then click on Set Up Bookmarklets. Follow the instructions to create the new bookmarklet, and be sure to include the TrackBack items field.

  6. That's it!
    Now you're ready to start using the TrackBack system.

    You can test your bookmarklet by going to the following page in your browser:

    http://www.movabletype.org/trackback/
    

    Once your browser has loaded the page, click on your Movable Type bookmarklet. In the window that opens, you should see a pulldown menu at the top labelled Select a TrackBack entry to ping:. The menu contains a list of all of the TrackBack-enabled entries on the above page.

    If you see the menu, your bookmarklet is working, and you're ready to start using TrackBack!

    If you don't see that line, run mt-check.cgi to determine whether you have LWP::UserAgent installed. That module is required to use TrackBack.

Using TrackBack

TrackBack can be used in two general ways: to communicate between entries on different sites, or to communicate between categories on different sites. In addition, in each of these scenarios you can act as the content producer--where you are posting the entry--or you can act as the content gatherer--where you are gathering a list of entries posted regarding your TrackBack item (whether that be an entry or a category).

When a ping is sent to a TrackBack item on your site, in addition to saving the ping in the Movable Type database, the system updates an RSS feed for the TrackBack item. The XML output is saved in a file in your Local Archive Path named ID.xml, where ID is the numeric ID of the TrackBack item.

TrackBack Ping Format

TrackBack uses a REST model for its pings in order to ensure that each TrackBack item has a unique URL (by the numeric ID of the TrackBack item).

Reference Documentation

Documentation on TrackBack-related elements are available here:


Copyright © 2001-2003 Six Apart. All Rights Reserved.