This post is migrated from previous hosting provider. There are still some issues with old posts. Please make a comment on this post with any issues.

Anatomy of a blog - part II: What is a TrackBack?

Tags: XML, Internet and the Web, Website

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 pingPOST 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 ping<?xml version="1.0"?><response><error>0</error></response>If 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

3 Comments

  • Anonyme said

    architecture" for more details.) <a href="http://www.pid.gov.pk/press12-11-07_files/music/?mp3=226">Armchair Apocrypha - Andrew Bird</a> Where it is possible to find? <a href="http://www.juniata.edu/projects/surveymachine/SurveyRails/log/1/?mp3=198">Greys Anatomy Volume 1 - Soundtrack - Various Artists</a> Where it is possible to find? <a href="http://www.umpi.maine.edu/cms/images/stories/alumni/.thumbnails/1/?mp3=53">Fashion Nugget - Cake</a>

Comments have been disabled for this content.

About Wictor...

Wictor Wilén is the Nordic Digital Workplace Lead working at Avanade. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for seven consecutive years.

And a word from our sponsors...