schema.orgdurationmicrodatarich-snippetsrecipe

Marking imprecise durations in recipe microdata


It's easy to markup a recipe's cooking or preparation time if it's for a specific time range:

Prep time: <time datetime="PT30M" itemprop="prepTime">30 min</time>
Cook time: <time datetime="PT1H" itemprop="cookTime">1 hour</time>

However, many recipes use estimated durations instead:

Prep time: 10-30 minutes
Cook time: 1 - 1½ hours

What's the best way of marking this information up in a way that'll be picked up by Google? From what I can tell, the ISO 8601 duration format doesn't seem to support "fuzzy" durations/duration ranges.

It's tempting to interpolate the time range so the machine-readable value sits halfway between the human-readable min/max values:

Prep time: <time datetime="PT20M" itemprop="prepTime">10-30 minutes</time>

Humans see:           10-30 minutes
Google/machines see:  20 minutes

That feels hacky and forced, though, and also feels like I'm feeding search engines incorrect data with specifics for the sake of SEO.


Solution

  • Short answer: I don’t think the time element as currently specified provides any good way to specify “fuzzy” durations.

    Longer answer

    This is by design a known issue/limitation in the current definition of the time element in the HTML spec. There’s been discussion about it, and some proposals for extending the scope of time to address that use case; see https://wiki.whatwg.org/wiki/Time_element#Fuzzy_dates

    The proposal that’s had the most traction is to add a certainty attribute to time that would allow you to do something like this:

    Prep time: <time datetime="PT20M" certainty="10M">10-30 minutes</time>
    

    Along with that certainty-attribute idea, there’s also been discussion of updating the specs for actual time formats to include a way to use ? or ~ characters to specify approximations; see http://www.loc.gov/standards/datetime/pre-submission.html#uncertain

    Anyway, there’s not yet been agreement about any of the proposed solutions, so gist of it remains that there’s unfortunately not yet any standard way to express a fuzzy duration—and I think also not really even any very good workarounds other than the one mentioned in the question.