What would Tantek do?

Published 21:17 on 16 February, 2006

A common problem, faced every day by web developers, is that of semantic markup. Having gone through the table-based disregard for HTML that was the mid 90s, we’ve come out the other side with stronger resolve. We now have the tools to seperate design from content (see Malarkey’s Web Standards Trifle); allowing us to concentrate on marking up the content with more meaning. This has, in turn, resulted in most of us going back to school to re-learn HTML so we can improve our understanding of the tags available to us.

To this end, Stuart and I regularly have discussions relating to the “best” methods of semantically marking up particular types of data. This, inevitably, degrades into idea-tennis™ and a mammoth, googled research session (to see what everybody else does). Ultimately, we ask that most familiar of developer’s questions: What would Tantek do?

Currently our discussions have been about two things; dates and comment rolls. So what are the best ways of marking these two items up?

Dates are a genuine nightmare (multiformats aside). As a developer, I want it to be obvious that the data I have marked up is a date; but there’s no tag available to do this. This is probably the only data type I can think of (without the prompting of the inevitable comments to follow) where this is the case.

Comment rolls, on the other hand, are a different kettle of fish. Obviously a comment roll should be some form of list; and 9 times out of 10 I prefer an ordered list (<ol>—it’s nice to know the order of the comments). However, how do I mark up the content of each list item? I’m inevitably going to want to include the comment text, but I also want to include a citation; and the date and time it was posted. Looking around the web it’s clear that a lot of developers (including Doug Bowman, Faruk AteÅŸ and Stuart) feel this is the perfect place for a definition list (<dl>)—citation and date as the definition term and comment text as the definition description. This makes sense to me but doesn’t allow the ordered nature of the <ol> (we’re talking sans-stylesheet here). The best way to get the best of both worlds (in my humble opinion) is to nest the <dl> within the <ol>. This results in something like the following:

<ol>
  <li>
    <dl>
      <dt>
        <cite>Stuart</cite>
        January 18, 2006 @ 9:53 pm
      </dt>
      <dd>
        <p>That would make a great T-shirt!</p>
      </dd>
    </dl>
  </li>
</ol>

In summary, I guess problems like this are always going to be open to interpretation. So let me finish this post with two simple questions: Has this sort of thing ever happened to you, and what did you do to solve it?

Answers on a comment roll to…