Table of contents:
Link sidebars (“linkblogs”) are increasingly popular among bloggers. They are built into Typepad, newer publishing systems have plug-ins for them, and enterprising young bloggers everywhere have devised their own solutions. Here’s how I do mine in Atom.
I am not aware that anything here is controversial. This tutorial is based on months-old information from the Atom project wiki, specifically Links Log and Link Tag Meaning. People who obsessively view-source might notice that I used to do my Atom linkblog differently. This is how I do it now, which is in line with the suggestions on the Atom wiki.
All the required elements of an Atom feed apply to linkblogs as well. The feed needs a title, an alternate link, and a last-modified date. As with any Atom feed, <author> is a required element, either on the feed level or on the entry level. Since I’m the sole author of my linkblog, I’ll put it on the feed level.
This is what I have so far:
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<title>dive into mark b-links</title>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/"/>
<modified>2004-05-27T03:48:48Z</modified>
<author>
<name>Mark Pilgrim</name>
</author>
</feed>
The alternate link for the feed points to the permanent archives for my linkblog.
To spruce this up, I’ll add some optional elements as well, including a tagline, an author URL (we’ll skip the email address; spammers don’t need any more help), a feed-level ID, a language declaration, and a copyright statement. (Hover your cursor over each new element for further explanation.)
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xml:lang="en">
<title>dive into mark b-links</title>
<tagline>an ongoing linkdump</tagline>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/"/>
<id>tag:diveintomark.org,2001-07-29:/archives/blinks/</id>
<copyright>Copyright 2001-2004, Mark Pilgrim</copyright>
<modified>2004-05-27T03:48:48Z</modified>
<author>
<name>Mark Pilgrim</name>
<url>http://diveintomark.org/</url>
</author>
</feed>
Now to the entries. An Atom entry needs a unique ID, a title, an alternate link (“permalink”), an issued date (specifying when it was first published), and a last-modified date.
<entry>
<title>Setting up an iTunes server in FreeBSD</title>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/2004/05/#b20040527034848"/>
<issued>2004-05-27T03:48:48Z</issued>
<modified>2004-05-27T03:48:48Z</modified>
<id>tag:diveintomark.org,2004-05-27:/archives/blinks/2004/05/#b20040527034848</id>
</entry>
The ID is big and scary, but it’s very important that it’s globally unique, and it’s not that hard to make globally unique IDs. I have a separate tutorial on how to make a good ID, which I’ll link here once it’s finished.
You’ve probably noticed that this linkblog isn’t terribly useful yet, since it’s not linking to anything! Of course there’s the alternate link, specifying the permanent link for the entry itself. This is a required element; all Atom entries need an alternate representation somewhere permanent. But what about the super-fascinating thing we’re actually linking to? That goes in its own <link> element.
<entry>
<title>Setting up an iTunes server in FreeBSD</title>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/2004/05/#b20040527034848"/>
<issued>2004-05-27T03:48:48Z</issued>
<modified>2004-05-27T03:48:48Z</modified>
<id>tag:diveintomark.org,2004-05-27:/archives/blinks/2004/05/#b20040527034848</id>
<summary>yay open standards</summary>
<link rel="related" type="text/html"
href="http://home.introweb.nl/~dodger/itunesserver.html"
title="Setting up an iTunes server in FreeBSD"/>
</entry>
I added a <summary>, which I use for a snarky comment about the link. And I added a <link rel="related">. Atom entries can have multiple links, and <link rel="related"> is for outgoing links. The semantics of rel="related" are very loose; other link elements are more specific, as you’ll see in a minute.
The syntax of the <link rel="related"> is the same as any other <link> element. Every Atom link has three required elements:
rel that specifies what kind of link it istype that specifies what type of content you should expect to find over therehref that specifies what you’re linking toThis link also has an optional title, which will probably be rendered as the link text in an aggregator. In this case, for maximum compatibility, I’m just duplicating the entry title. In theory, the entry title could be left blank (literally just <title></title>), but aggregators (especially three-paned aggregators) don’t seem to deal with that very well. The duplication will seem less annoying once we start adding more links.
What’s that? Did I say “more links”? Why yes! An Atom entry can contain multiple links. Is there another link you feel is related to this same topic? Link to it!
<entry>
<title>Setting up an iTunes server in FreeBSD</title>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/2004/05/#b20040527034848"/>
<issued>2004-05-27T03:48:48Z</issued>
<modified>2004-05-27T03:48:48Z</modified>
<id>tag:diveintomark.org,2004-05-27:/archives/blinks/2004/05/#b20040527034848</id>
<summary>yay open standards</summary>
<link rel="related" type="text/html"
href="http://home.introweb.nl/~dodger/itunesserver.html"
title="Setting up an iTunes server in FreeBSD"/>
<link rel="related" type="text/html"
href="http://developer.apple.com/macosx/rendezvous/faq.html"
title="Apple Rendezvous FAQ"/>
</entry>
You can have as many related links as you like.
Ever since it was discovered that bloggers kill kittens plagiarize constantly tend to republish links without saying where they found them, the concept of a “via” link has risen to prominence. Simply put, a “via” link is a link back to where you found the link you’re posting.
In this example, I discovered the article on setting up a FreeBSD iTunes server via Jeffrey Veen, so let’s give him some credit:
<entry>
<title>Setting up an iTunes server in FreeBSD</title>
<link rel="alternate" type="text/html"
href="http://diveintomark.org/archives/blinks/2004/05/#b20040527034848"/>
<issued>2004-05-27T03:48:48Z</issued>
<modified>2004-05-27T03:48:48Z</modified>
<id>tag:diveintomark.org,2004-05-27:/archives/blinks/2004/05/#b20040527034848</id>
<summary>yay open standards</summary>
<link rel="related" type="text/html"
href="http://home.introweb.nl/~dodger/itunesserver.html"
title="Setting up an iTunes server in FreeBSD"/>
<link rel="related" type="text/html"
href="http://developer.apple.com/macosx/rendezvous/faq.html"
title="Apple Rendezvous FAQ"/>
<link rel="via" type="text/html"
href="http://www.veen.com/jeff/archives/000545.html"
title="Jeffrey Veen"/>
</entry>
The “via” link is the permalink of Jeffrey’s post where I found the link. Sadly, not everyone has permanent archives for their linkblogs, but the “via” link should be a specific as possible.
There’s a nice bit of symmetry here. If someone is reading your linkblog and decides to republish one of your links, they can take your <link rel="alternate"> and make it their <link rel="via">. Combined aggregator/editor progams can do this automatically.
My live linkblog is at diveintomark.org/xml/blink.xml. Feel free to subscribe in your favorite Atom-enabled aggregator, but don’t expect miracles. Atom is still evolving, and not all aggregators support multiple links as well as they could. They’re not wrong; how client software renders links — or whether it renders them at all — is entirely up to the client developer. Hopefully this tutorial will also serve as a guide for client-side developers to show them how Atom is being used, so they can make their Atom-enabled software even more useful.
§
I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)
§
© 2001–9 Mark Pilgrim