[ptsefton.com] | [CV & Bio]

Recipe Markup Theory and a Practice


Ben Hammersley is writing teases about recipes. Apparently he's working on an online recipe database. He has links to two ways of structuring recipes. When I put up recipes here I may or may not use one of those to create them. But I will put some kind of markup on the HTML I serve for (at least) the recipe as a whole and the list of ingredients. If other people used the same classes then that would indeed be Hammersley's 'loosely joined, lightly grilled web coolness'.

I call this approach Udellian. When the XHTML-aware search engines advocated by Jon Udell start to arrive we will be able mine recipes across the Internet, or at least within our own caches, regardless of the back-end software used to create them. While we're talking recipes here, the same thing would apply to other domains, such as course materials, where parts of a page could be marked up as 'activity' or 'quiz'.

In XPATH you could ask:

//*[@class='recipe' and .//*[@class='ingredients' and contains(.,'lemon') and contains(.,'tuna')]] 

Which I assert means "get me any element with a class of recipe, which has somewhere within it a element of class ingredients containing the string lemon and the string tuna". And yes we have a potential case problem here, although not if you are careful about wording. Of course we would put this behind a nicer interface for recipe-finding.

Here's my version of Bill Granger's baked Tuna Risotto with Tomatoes, from the Australian version of Delicious magazine, March 2003. My partner forces me to cook this about once a week.

I present this with 'recipe' and 'ingredients' as class names but I imagine a system for broader use would have a namespace-style prefix.

Recipe: Baked Tuna Risotto


  • Some olive oil
  • 1 onion
  • 1 chili
  • 1 800g can of tuna (Bill recommends Sirena brand 'Itlalian Style' tuna suffering in spring water, I say go for the one luxuriating in oil)
  • 1 cup Arborio rice
  • 1 cup dry white wine (goon will do nicely)
  • 1/2 cup water
  • 1 400g can of tomatoes
  • Handful of basil, and or mint.
  • Some wedges of lemon or lime.

Preheat your oven to 200 degrees c.

Get a big pot with a lid. A cast-iron enameled one is good.

In the big pot, cook the onion in olive oil for a while then chuck in chili and the rice and get it hot. Add the(drained) Tuna, tomato and the liquid. Bring to the boil. Whack on the lid and stick it in the oven for half an hour.

To serve, throw on the herbs, torn up, and squeeze on lemon juice. Remember that the lid is very very hot.

Bill's original had no wine, only water. Some variations:

Ingredients Variations

  • Handful of olives
  • Vegetables — I have no idea which ones but my sister says she puts veges in. I wouldn't.