Trackback Technical Specification

Source: Internet
Author: User
Tags pings movable type
Document directory
  • Trackback Technical Specification
Trackback Technical Specification

  • Name
  • Authors
  • Version
  • Description
  • Sending a trackback Ping
  • Retrieving trackback pings
  • Auto-discovery of trackback Ping URLs
  • Examples
    • Sample trackback implementation
    • Sample auto-discovery
  • Changes
    • 1.1 (October 10,200 2)
    • 1.0 (August 28,200 2)
  • Credits
Name

Mttrackback-trackback Technical Specification

Authors

Benjamin and Mena Trott, movabletype.org

Version

1.1

Description

This document describes trackback, a framework for peer-to-peer communication and communications between web sites. The central idea behind trackback is the idea ofTrackback Ping, A request saying, essential, ''resource A is related/linked to resource B. ''a trackback''' resource ''is represented byTrackback Ping URL, Which is just a standard Uri.

Using trackback, sites can communicate about related resources. for example, if weblogger A wishes to notify y weblogger B that he has written something interesting/related/shocking, A sends a trackback ping to B. this accomplishes two things:

  1. Weblogger B can automatically list all sites that have referenced a particle post on his site, allowing visitors to his site to read all related posts around the Web, including weblogger A's.

     

  2. The Ping 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 ).

     

Sending a trackback Ping

Trackback uses a rest model, where requests are made through standard http cils. to send a trackback Ping, the client makes a standard HTTP request to the server, and receive es a response in a simple XML format (see below for more details ).

In the trackback system, the URL that your es trackback pings is the trackback Ping URL. A typical trackback Ping URL looks likeHttp://www.foo.com/mt-tb.cgi/5, Where5Is the trackback ID. Server implementations can use whatever format makes sense for the trackback Ping URL; client implementations shocould not depend on a particle format.

To send a ping, the client sends an http post request to the trackback Ping URL. The request contents shocould be of the content typeapplication/x-www-form-urlencoded. For example, a ping request to the URLHttp://www.foo.com/mt-tb.cgi/5Might look like this:

POST http://www.foo.com/mt-tb.cgi/5Content-Type: application/x-www-form-urlencodedtitle=Foo+Bar&url=http://www.bar.com/&excerpt=My+Excerpt&blog_name=Foo

The possible parameters are:

  • Title
    The title of the entry.

     

  • Excerpt
    An excerpt of the entry. In the movable type implementation, if this string is longer than 255 characters, it will be cropped to 252 characters, and...Will be added to the end.

     

  • URL
    The permalink for the entry. Like any permalink, this shoshould point as closely as possible to the actual entry on the HTML page, as it will be used when linking to the entry in question.

     

  • Blog_name
    The name of the blog in which the entry is posted.

     

In the movable type implementation, of the above parameters onlyURLIs required. IfTitleIs not provided, the valueURLWill be set as the title.

The response to the above query is in a simple XML format to enable application-level error detection (http-level errors will be returned as such -- for example, if the trackback URL points to a non-existent location on the server,404Error will be returned from the ping ).

A successful Ping will return the following response:

<?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response>

A failed Ping will return the following response:

<?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>The error message</message></response>

Applications shocould, of course, allow for the future addition of fields, if necessary. But the XML structure of the response will remain the same.

Retrieving trackback pings

To retrieve the list of pings sent to a particle trackback Ping URL, send an http get request to the trackback Ping URL with the query string? _ Mode = RSS. In future revisions of the specification -- once the grace period for switching to get from post has passed -- this may be simplified such that sending a GET request to the trackback Ping URL will return the list pings.

A sample GET request might look like this:

GET http://192.168.1.103/mt/mt-tb.cgi/3?__mode=rss

The response to this request will either be an error in the same format as returned from the above request, or the list of trackback pings for that item in RSS markup, wrapped in<response>Tags.

For example:

<?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error><rss version="0.91"><channel><title>TrackBack Test</title><link>http://this.is/the/trackback/item/link/</link><description>Description of the TrackBack item</description><language>en-us</language><item><title>TrackBack Demo</title><link>http://this.is/the/permalink/</link><description>Excerpt</description></item></channel></rss></response>

The portions<rss>And</rss>Are the actual RSS data; the rest is simply the response wrapper, and can be discarded.

Auto-discovery of trackback Ping URLs

Trackback clients need a method of determining the trackback Ping URL for a particle URL or weblog entry. server implementations shocould include embedded RDF in the pages they produce; the RDF represents metadata about an entry, allowing clients to auto-discover the trackback Ping URL.

Sample RDF looks like this:

<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:Descriptionrdf:about="http://www.foo.com/archive.html#foo"dc:identifier="http://www.foo.com/archive.html#foo"dc:title="Foo Bar"trackback:ping="http://www.foo.com/tb.cgi/5" /></rdf:RDF>

Note: Because current validators choke on RDF embedded in XHTML, if you want your pages to validate you may wish to enclose the above RDF in HTML comments:

<!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"...</rdf:RDF>-->

This is not a perfect solution, but it works as a temporary fix.

TheDC:Elements are standard Dublin Core elements;Trackback: PingElement comes from the trackback module for RSS 1.0/2.0Http://madskills.com/public/xml/rss/module/trackback/.

Given a URLMy_url, Clients shoshould follow these steps:

  1. Send an http get request to retrieve the contents of the pageMy_url.

     

  2. Scan the page contents for embedded RDF. pages can contain multiple instances of embedded RDF -- clients shocould pick the block whoseDC: identifierMatchesMy_url.

     

  3. ExtractTrackback: PingValue from the block of RDF. This is the trackback Ping URL.

     

Once the client has determined the trackback Ping URL, it can send a trackback Ping (see sending a trackback ping ).

Example auto-discovery code is below in examples.

Examples

Sample trackback implementation

To aid perspective developers in implementing trackback in their own systems, we are releasing a standalone Implementation of trackback that is not dependent on movable type. it accepts pings sent through HTTP requests, stores the pings locally in the filesystem, and can return a list of pings sent on a particle trackback item in RSS format. it also generates RSS files statically, if you want it. this can be useful for including a list of the last 15 trackback pings on a sidebar on your site, for example.

The standalone implementation can be downloaded fromHttp://www.movabletype.org/downloads/tb-standalone.tar.gz.

It is released under the artistic license. The terms of the artistic license are describedHttp://www.perl.com/language/misc/Artistic.html.

Installation and usage instructions areHttp://www.movabletype.org/docs/tb-standalone.html.

Sample auto-discovery
use LWP::UserAgent;sub discover_tb {my $url = shift;my $ua = LWP::UserAgent->new;$ua->agent('TrackBack/1.0');$ua->parse_head(0);   ## So we don't need HTML::HeadParser$ua->timeout(15);## 1. Send a GET request to retrieve the page contents.my $req = HTTP::Request->new(GET => $url);my $res = $ua->request($req);return unless $res->is_success;## 2. Scan te page contents for embedded RDF.my $c = $res->content;(my $url_no_anchor = $url) =~ s/#.*$//;my $item;while ($c =~ m!(<rdf:RDF.*?</rdf:RDF>)!sg) {my $rdf = $1;my($perm_url) = $rdf =~ m!dc:identifier="([^"]+)"!;next unless $perm_url eq $url || $perm_url eq $url_no_anchor;## 3. Extract the trackback:ping value from the RDF.## We look for 'trackback:ping', but fall back to 'about'if ($rdf =~ m!trackback:ping="([^"]+)"!) {return $1;} elsif ($rdf =~ m!about="([^"]+)"!) {return $1;}}}

This Perl code defines a subroutineDiscover_tb. Given a URL, it attempts to discover the trackback Ping URL corresponding to that URL. if it finds it, it returns the trackback Ping URL; otherwise it returnsundef.

Changes

1.1 (October 10,200 2)
  • Trackback pings shoshould now be sent using http post instead of get. The old behavior is deprecated, and support for get will be removed in January 2003.

     

  • In the RDF, The trackback Ping URL shocould now be stored inTrackback: PingElement, ratherRDF: About.

     

  • Changed the format of the sample trackback Ping URL to use the path_info instead of the query string.

     

  • The embedded RDF used for auto-discovery no longer causes pages to fail validation.

     

  • Added sample code for auto-discovery.

     

1.0 (August 28,200 2)

Initial Release.

Credits

Thanks to Paul prescod and others for their guidance on making trackback more rest-like.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.