This is the second part of my dissection of a blog and I will try to explain what a TrackBack is.TrackBack is a way to communicate between blogs; for example when a blogger writes a post with comments/links to another blog the blogger can inform the blog that is being commented with a TrackBack ping. This ping will normally be fetched by the commented blog and appended as a comment.To get this to work, both the commenting blog and commented blog has to support the TrackBack protocol, see below.

And here is how it works when doing a TrackBack automatically.The commenting blog tool searches through all the URL’s in the new blog entry and performs an HTTP GET request to retrieve the TrackBack ping address. The TrackBack ping address is normally included in the posts HTML code as a embedded RDF. The HTML code should be parsed and if a RDF section is found extract the value of the trackback:ping attribute, which contains the URL to which the TrackBack ping should be sent.

Example of embedded RDF<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.wictorwilen.se/Post/68.aspx"dc:identifier="http://www.wictorwilen.se/Post/68.aspx"dc:title="Sending mail with Ctrl+Enter in Outlook 2007”trackback:ping="http://www.wictorwilen.se/trackback.aspx?id=68" /></rdf:RDF>

If the RDF and the trackback:ping attribute is found, a TrackBack ping should be sent to the URL. The ping is done using the REST model. The client sends a normal HTTP POST request with a Content-Type header with the value application/x-www-form-urlencoded and a few parameters; title, excerpt, url and blog_name. Only the url parameter is required and should contain the permalink for the blog entry sending the ping.

_Example of a TrackBack ping_POST http://www.wictorwilen.se/trackback.aspx?id=68Content-type:  application/x-www-form-urlencoded; charset=utf-8

title=My+new+entry&url=http://www.company.com/post/1&excerpt=Excerpt+of+new+entry&blog_name=Company+Blog

The pinged server returns an XML formatted response which indicates failure or success.Example of successfull ping0If the ping failed, the error element should contain a non-zero value and a message element with the error message should be included in the response.

That’s it! If you are implementing your own blog engine, this may be of use but if you use a blog tool like blogger, Movable Type etc this will be done for you behind the scenes.

Note: A TrackBack ping should only be sent once!

Full technical specification can be found at http://www.sixapart.com/pronet/docs/trackback_spec