Schema.org for complex or multi-part recipes

1.1k views Asked by At

I am trying to determine how to mark up a Recipe in Schema.org where the recipe has multiple sub-recipes.

For example: A Victoria Sponge might have:

Set #1: Ingredients, preparation steps, and prep/cook times for the Sponge
Set #2: Ingredients, preparation steps, and prep times for the Filling
Set #3: Ingredients, preparation steps, and prep times for the Icing/Topping

I have seen recipe examples where all the ingredients are together in a list and the instructions/steps then attempt to determine which is use at which point, but this is not really satisfactory.

Obvious approaches are: separate recipe components, or perhaps an "array" of ingredients and steps. And, I can see it ought to be possible using a HowTo structure of steps of sub-recipes, but cannot see how.

I'd really like to see an example that has actually been tried. I am using JSON-LD, but anything that demonstrates a principle would be much appreciated!

1

There are 1 answers

3
unor On

If you need to group the ingredients per "sub-recipe", you have to provide multiple Recipe items, because the recipeIngredient property is only defined for the Recipe type.

I don’t know if such a model was intended, but it seems to be possible with the specified expected values. It works if you think that a Recipe instruction step can be a Recipe itself.

JSON-LD example

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Recipe",
  "recipeInstructions": {
    "@type": "ItemList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "item": {
          "@type": "HowToStep"
        }
      },
      {
        "@type": "ListItem",
        "position": 2,
        "item": {
          "@type": "HowToSection",
          "steps": {
            "@type": "Recipe"
          }
        }
      },
      {
        "@type": "ListItem",
        "position": 3,
        "item": {
          "@type": "HowToStep"
        }
      }
    ]
  }
}
</script>

Example explanation

  • The main Recipe has three instruction steps.

  • ListItem is used to give each step a position (so that the ItemList is ordered).

  • The first and the last steps are HowToStep items. A HowToStep is a list that can take HowToDirection and HowToTip items as list entries.

  • The second step is a HowToSection item. HowToSection is a "sub-grouping of steps". Its definition gives this example, which seems to fit your case:

    steps for making a pie crust within a pie recipe

    Now, instead of representing this HowToSection’s steps again as a list of HowToStep items, the sub-recipe is given as Recipe item. This is possible because steps has CreativeWork as expected value, of which Recipe is a sub-type.


(Note that Google’s SDTT doesn’t recognize the HowTo types yet. They were introduced with the current Schema.org version 3.3, which was released last month.)