Blogging about Blogging

One of the nice, collaborative features in blogs these days is the ability to leave comments.  But what if you, on your blog, are trying to comment about something somebody else blogged about?  Well, you would use some kind of linkback that would refer to the other blog, and leaves a comment on their blog that you were there.

Previously, we implemented trackbacks as a basic way for doing this.  If you've ever posted a blog message, you have undoubtedly seen the "Trackbacks to Send" field below your content.  You would enter their trackback URL there and, if all goes well, you will see a comment on the other blog that refers back to yours.  In most systems the trackback URL is different from the post URL.  So, for example, Liferay's trackback URL looks something like this:

http://localhost:8080/web/test/home/-/blogs/trackback/this-is-my-blog-entry

As opposed to the actual blog entry URL which looks like this:

http://localhost:8080/web/test/home/-/blogs/this-is-my-blog-entry

I've got to find this person's trackback URL, and copy and paste it into my blog.  Suffice it to say, this is actually a bit cumbersome.  

Well, in comes pingbacks (being introduced in Liferay v6.0).  Pingbacks are a version of linkbacks that is much more simple to use.  Why?  Because you don't really have to do anything!  So let's say somebody posts a message that I though was pretty interesting.  All I do is link that blog URL in the body of my blog entry.  I would normally be doing that anyhow.

When you publish the blog entry, Liferay will scan through its contents and look for any hyperlinks (<a href=""> tags). If it finds any, it will check with each URL to see if it supports pingbacks (support is normally indicated by the presence of an X-Pingback header for that page). If it does, a few minutes after the entry is posted, Liferay posts an XML-RPC call to the pingback server telling the server that you just mentioned their blog entry in yours. If everything checks out ok, then in the other person's blog, you will see a comment summarising and linking back to your entry.

Voila!

You can of course turn this option off if you like.  Liferay blogs will also work as both consumers and producers of pingbacks, so it will talk to other servers like WordPress or Moveable Type.  Incidentally, Blogspot does not support pingbacks or trackbacks, too bad. :(

Blogs