Skip to content

Improve json-ld output #291

@cmdoret

Description

@cmdoret

The serialization of recipes to schema could be improved in several ways:

  • The index of the step is encoded as free text in name, but HowToStep has a dedicated order integer property for it.
  • Timers could be used to attach duration to HowToStep via timeRequired.
  • Sections are ignored, maybe they could be included as headine or name, either on the first step of the section, or every step in the section?

I am happy to try and implement those, if that is something desirable!

Below is an example that illustrates those points.

---
title: Maple Chili Sweet Potatoes
cuisine: mediterranean
tags:
  - vegan
image: https://twocupsofhealth.com/wp-content/uploads/2019/11/BC0828DC-1C30-4246-AD43-D91793AE5C02.jpeg
---

== Preparation ==

Whisk @olive oil{2%tbsp}, @maple syrup{2%tbsp}, @chili powder{1%tsp}, @cayenne pepper{1/4%tsp}, 
and @salt{1/4%tsp} together.

== Cooking ==

Toss the glaze with @sweet potatoes{2%medium}(cut into 1.5 cm chunks) and spread on a #baking sheet{}. 
Roast at 220°C, stirring halfway through, until golden brown and tender, ~{40%minutes}.
{
  "@context": "https://schema.org",
  "@type": "Recipe",
  "image": "https://twocupsofhealth.com/wp-content/uploads/2019/11/BC0828DC-1C30-4246-AD43-D91793AE5C02.jpeg",
  "keywords": "vegan",
  "name": "Maple Chili Sweet Potatoes",
  "recipeCuisine": "mediterranean",
  "recipeIngredient": [
    "2 tbsp olive oil",
    "2 tbsp maple syrup",
    "1 tsp chili powder",
    "1/4 tsp cayenne pepper",
    "1/4 tsp salt",
    "2 medium sweet potatoes, cut into 1.5 cm chunks"
  ],
  "recipeInstructions": [
    {
      "@type": "HowToStep",
      "name": "Step 1",
      "text": "Whisk olive oil, maple syrup, chili powder, cayenne pepper, and salt together."
    },
    {
      "@type": "HowToStep",
      "name": "Step 2",
      "text": "Toss the glaze with sweet potatoes and spread on a baking sheet. Roast at 220°C, stirring halfway through, until golden brown and tender, 40 minutes."
    }
  ],
  "tool": [
    "baking sheet"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions