astro-structured-datav2.0.1

← All examples

Recipe

Instruction steps with names become HowToStep items; durations stay ISO 8601.

Recipe

examples/recipe.astro
---
import { RecipeSchema } from '@casoon/astro-structured-data/components';
---

<RecipeSchema
  name="Classic Chocolate Chip Cookies"
  description="Crispy edges, chewy and soft in the center."
  imageUrl="/images/cookies.jpg"
  authorName="Baker Bob"
  prepTime="PT15M"
  cookTime="PT10M"
  recipeYield="12 cookies"
  ingredients={['200g butter', '150g brown sugar', '2 eggs', '300g flour', '200g chocolate chips']}
  instructions={[
    { name: 'Preheat', text: 'Preheat oven to 190°C.' },
    { name: 'Make dough', text: 'Mix butter, sugar and eggs. Fold in flour and chocolate chips.' },
    { name: 'Bake', text: 'Scoop onto a sheet and bake for 10 minutes.' },
  ]}
/>
{
  "@context": "https://schema.org",
  "@type": "Recipe",
  "name": "Classic Chocolate Chip Cookies",
  "description": "Crispy edges, chewy and soft in the center.",
  "image": [
    "/images/cookies.jpg"
  ],
  "author": {
    "@type": "Person",
    "name": "Baker Bob"
  },
  "recipeIngredient": [
    "200g butter",
    "150g brown sugar",
    "2 eggs",
    "300g flour",
    "200g chocolate chips"
  ],
  "recipeInstructions": [
    {
      "@type": "HowToStep",
      "text": "Preheat oven to 190°C.",
      "name": "Preheat"
    },
    {
      "@type": "HowToStep",
      "text": "Mix butter, sugar and eggs. Fold in flour and chocolate chips.",
      "name": "Make dough"
    },
    {
      "@type": "HowToStep",
      "text": "Scoop onto a sheet and bake for 10 minutes.",
      "name": "Bake"
    }
  ],
  "prepTime": "PT15M",
  "cookTime": "PT10M",
  "recipeYield": "12 cookies"
}
  • Recipe
  • RecipeSchema