Welcome to Squishdot Websites Squishdot How-To Newbies
 post article
 Mailing Lists
 Bug Tracking


Adding Trackback to Squishdot
How-To Posted by Manuel Aristarán on Thursday July 03, 07:17PM, 2003
from the not-that-kinda-ping dept.

Last year, the authors of MovableType (a popular CMS oriented to weblogs) came up with the concept of trackback: "[...] it's a way of recording who has linked to your posts and notifying others that you've linked to them" (from hitormiss.org)

This article aims to describe a basic implementation of trackback for Squishdot-powered weblogs.

Trackback pings

Suppose you wrote an article in your Squishdot based site. Another weblogger read the piece and posted a link to it on her weblog along with some related comments. Here is where trackback enters: in addition to linking to your article, she could ping it. That way, you and your readers would know that another person wrote something about the topic of your posting.

Then, trackback, in addition to traditional HTML linking, is another way of communication between weblogs.

The Trackback Development weblog at movabletype.org could serve as a working example of this.


Any trackback-enabled weblog system should be able to:

  • receive and store trackback pings
  • display trackback pings
  • (optionally) send trackback pings.
Receiving and storing pings

A trackback ping is just an HTTP ‘POST’ request to a given URL. According to the official specification, the POSTed variables should be:

  • title
    The title of the entry
  • excerpt
    An excerpt of the entry.
  • url
    The permanent link for the entry. Like any permalink, this should 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.
    This is the only mandatory variable.
  • blog_name
    The name of the blog in which the entry is posted

Every posting must provide an URL to receive pings. If the Squishdot site is at http://www.example.com/, this URL will be of the form:


For storing pings, we will use the ubiquitous TinyTablePlus product from Endicor and Shane Hathaway.

First of all, create a Folder named ‘trackback’ in the Squishdot root. This will contain the instance of TinyTablePlus and another scripts.

Then create an instance of TinyTablePlus and name it ‘trackbackStore’. Type the following in the ‘Columns’ text field:

id:int post_id:int url title excerpt blog_name added:datetime

Pings will come from Anonymous requests, so anonymous users must be allowed to query the table for both reading and writing. Go to the Security tab of the trackbackStore object and check the boxes in the Anonymous column for "Change TinyTable" and "Query TinyTable Data" permissions.

Go back to your site’s root folder and create a new instance of "Script (Python)". Name it ‘tb’. This script will be responsible of receiving the trackback ping, checking the POSTed variables and creating a new row in trackback.trackbackStore if everything is correct.

tb (Python Script):
request = container.REQUEST
# ID of pinged posting
post_id = int(context.id)
# POSTed variables dictionary
tbargs = {}
tbargs['blog_name'] = ""
tbargs['title'] = ""
tbargs['excerpt'] = ""
  tbargs['url'] = getattr(request,"url")
  print context.trackback.responseXML(1,"URL is missing")
  return printed

if hasattr(request, "blog_name"):
  tbargs['blog_name'] = getattr(request, "blog_name")
if hasattr(request, "title"):
  tbargs['title'] = getattr(request, "title")
if hasattr(request, "excerpt"):
  tbargs['excerpt'] = getattr(request, "excerpt")
# Store the ping
context.trackback.trackbackStore.setRow(id = len(context.trackback.trackbackStore())+ 1,
                                   post_id = post_id,
                                   url = tbargs['url'],
                                   title = tbargs['title'],
                                   excerpt = tbargs['excerpt'],
                                   blog_name = tbargs['blog_name'],
                                   added = context.ZopeTime())
print context.trackback.responseXML(0,"")
return printed
# ---- * ----

As you may have noticed, this script uses something we haven’t defined yet: context.trackback.responseXML(). That object (a Python Script) will generate the response for the received ping.

Ping responses are a little chunk of XML. If we’ve received a "correct" ping, the response will be:

<?xml version="1.0" encoding="iso-8859-1"?>

If there’s any error, for instance omitting the ‘url’ variable, this will be the answer:

<?xml version="1.0" encoding="iso-8859-1"?>
  <message>URL is missing</message>

Create an instance of "Script (Python)" inside the trackback folder you created and name it 'responseXML'. This script must accept two input parameters: errorCode and errorMsg.

responseXML (Python Script):
resp  = '<?xml version="1.0" encoding="iso-8859-1"?>\n'
resp += '<response>\n'
resp += '<error>' + str(errorCode) + '</error>\n'
if errorMsg != '':
  resp += '<message>' + errorMsg + '</message>\n'
  resp += '</response>\n'
return resp
# ---- * ----
Displaying pings

In this section we’ll see how to retrieve and display stored pings for a given post. Each Squishdot site has a particular visual appearance, so the following examples just suggest how to show the data.

This DTML snippet will list how many trackback pings were received by each of the postings returned by item_list (a list containing the newest postings, provided by the Squishdot API):

<dtml-in item_list>
  <li>posting id: <dtml-var id> - tbpings: <dtml-var "_.len(trackback.trackbackStore(post_id=_.int(_['id'])))">

If we want to actually fetch and display the list of pings that a given posting has received, we can write something like this:

(let postID be the actual ID of a particular posting)
<dtml-in "trackback.trackback(post_id=postID)">
  <li>title: <dtml-var title><br>
  url: <dtml-var url><br>
  blogname: <dtml-var blog_name><br>
  received on: <dtml-var added><br>
  excerpt: <dtml-var excerpt><br>
  No pings for this posting
Sending Pings

Actually, you can’t send trackback pings directly from Squishdot. But you can use Matt Croydon's Trackback library (http://www.postneo.com/projects/tblib/).

Final Remarks

I wrote this scripts to give my weblog (http://jazzido.freezope.org) trackback support.
It works-for-me (tm), but I can't guarrantee they'll do it for you :). If you have any questions, drop me an email (mpairetti at softhome dot net)

<  |  >


Related Links
  • Articles on How-To
  • Also by Manuel Aristarán
  • Contact author
  • The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Re: Adding Trackback to Squishdot
    by Anónimo on Friday July 18, 12:03PM, 2003
    The third link in the article(labeled "Trackback Development weblog") is wrong.
    [ Reply to this ]
    Re: Adding Trackback to Squishdot
    by Bill Karl on Wednesday February 08, 06:35PM, 2006
    I still don't get it. If I go to someone's blog. see an article I like, I then click on trackback under the article and what happens? I've done that, then the page "refreshes" but I'm not seeing any box open as it would with a comment box.

    I was told I need to go to a trackback generator? What's that? And where's that? As a member of Blog City, I have trackbacks listed on my blog. Do I still need a trackback generator?

    Yhanks in advance.
    [ Reply to this ]
    The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Powered by Zope  Squishdot Powered
      "Any system that depends on reliability is unreliable." -- Nogg's Postulate
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©1999 Butch Landingin, ©2000-2002 Chris Withers.