JAVASCRIPTseobeginner

Recipe Schema for Food Blogs

Add Recipe structured data for Google recipe cards with cooking time, nutrition, and star ratings

Faisal Yaqoob
#recipe#schema#seo#structured-data#json-ld#food-blog#cooking#rich-snippets#google
Share this snippet:

Code

javascript
1const recipeSchema = {
2 "@context": "https://schema.org",
3 "@type": "Recipe",
4 "name": "Classic Chicken Tikka Masala",
5 "description": "Authentic chicken tikka masala recipe with tender marinated chicken in a rich, creamy tomato-based curry sauce. Perfect for weeknight dinners.",
6 "image": [
7 "https://yoursite.com/images/tikka-masala-1x1.jpg",
8 "https://yoursite.com/images/tikka-masala-4x3.jpg",
9 "https://yoursite.com/images/tikka-masala-16x9.jpg"
10 ],
11 "author": {
12 "@type": "Person",
13 "name": "Your Name",
14 "url": "https://yoursite.com/about"
15 },
16 "datePublished": "2025-12-30",
17 "prepTime": "PT30M",
18 "cookTime": "PT45M",
19 "totalTime": "PT1H15M",
20 "recipeCategory": "Main Course",
21 "recipeCuisine": "Indian",
22 "recipeYield": "4 servings",
23 "keywords": "chicken tikka masala, indian curry, easy tikka masala, weeknight dinner",
24 "nutrition": {
25 "@type": "NutritionInformation",
26 "calories": "485 calories",
27 "fatContent": "22g",
28 "saturatedFatContent": "8g",
29 "carbohydrateContent": "18g",
30 "fiberContent": "3g",
31 "sugarContent": "8g",
32 "proteinContent": "52g",
33 "sodiumContent": "680mg",
34 "cholesterolContent": "145mg"
35 },
36 "recipeIngredient": [
37 "800g boneless chicken thighs, cut into chunks",
38 "1 cup plain yogurt",
39 "2 tablespoons lemon juice",
40 "2 teaspoons ground cumin",
41 "2 teaspoons paprika",
42 "1 teaspoon turmeric",
43 "1 teaspoon garam masala",
44 "1 teaspoon salt",
45 "2 tablespoons vegetable oil",
46 "1 large onion, finely diced",
47 "4 cloves garlic, minced",
48 "1 tablespoon fresh ginger, grated",
49 "1 can (400g) crushed tomatoes",
50 "1 cup heavy cream",
51 "Fresh cilantro for garnish"
52 ],
53 "recipeInstructions": [
54 {
55 "@type": "HowToStep",
56 "name": "Marinate the Chicken",
57 "text": "Combine yogurt, lemon juice, cumin, paprika, turmeric, garam masala, and salt in a large bowl. Add chicken pieces and coat well. Cover and refrigerate for at least 1 hour or overnight.",
58 "image": "https://yoursite.com/images/step1-marinate.jpg"
59 },
60 {
61 "@type": "HowToStep",
62 "name": "Cook the Chicken",
63 "text": "Heat oil in a large skillet over medium-high heat. Remove chicken from marinade and cook until browned on all sides, about 5-6 minutes. Set aside.",
64 "image": "https://yoursite.com/images/step2-cook-chicken.jpg"
65 },
66 {
67 "@type": "HowToStep",
68 "name": "Make the Sauce",
69 "text": "In the same pan, add onion and cook until softened. Add garlic and ginger, cook for 1 minute. Add crushed tomatoes and simmer for 15 minutes until thickened.",
70 "image": "https://yoursite.com/images/step3-sauce.jpg"
71 },
72 {
73 "@type": "HowToStep",
74 "name": "Combine and Simmer",
75 "text": "Return chicken to the pan. Stir in heavy cream and simmer for 15-20 minutes until chicken is cooked through and sauce is rich and creamy.",
76 "image": "https://yoursite.com/images/step4-simmer.jpg"
77 },
78 {
79 "@type": "HowToStep",
80 "name": "Serve",
81 "text": "Garnish with fresh cilantro and serve hot over basmati rice or with warm naan bread.",
82 "image": "https://yoursite.com/images/step5-serve.jpg"
83 }
84 ],
85 "aggregateRating": {
86 "@type": "AggregateRating",
87 "ratingValue": "4.8",
88 "bestRating": "5",
89 "ratingCount": "342",
90 "reviewCount": "215"
91 },
92 "review": [
93 {
94 "@type": "Review",
95 "author": {
96 "@type": "Person",
97 "name": "FoodLover99"
98 },
99 "datePublished": "2025-12-15",
100 "reviewBody": "Best tikka masala recipe I've found online. The overnight marination makes all the difference!",
101 "reviewRating": {
102 "@type": "Rating",
103 "ratingValue": "5",
104 "bestRating": "5"
105 }
106 }
107 ],
108 "video": {
109 "@type": "VideoObject",
110 "name": "How to Make Chicken Tikka Masala",
111 "description": "Step-by-step video tutorial for making authentic chicken tikka masala at home.",
112 "thumbnailUrl": "https://yoursite.com/images/tikka-video-thumb.jpg",
113 "uploadDate": "2025-12-30",
114 "duration": "PT8M30S",
115 "embedUrl": "https://www.youtube.com/embed/VIDEO_ID"
116 }
117};

Recipe Schema for Food Blogs

Add Recipe structured data to get Google recipe rich results — large visual cards in search results showing your recipe image, rating stars, cooking time, and calorie count. Recipe schema is one of the most visually impactful rich results available.

Complete Recipe Schema

const recipeSchema = {
  "@context": "https://schema.org",
  "@type": "Recipe",
  "name": "Classic Chicken Tikka Masala",
  "description": "Authentic chicken tikka masala recipe with tender marinated chicken in a rich, creamy tomato-based curry sauce. Perfect for weeknight dinners.",
  "image": [
    "https://yoursite.com/images/tikka-masala-1x1.jpg",
    "https://yoursite.com/images/tikka-masala-4x3.jpg",
    "https://yoursite.com/images/tikka-masala-16x9.jpg"
  ],
  "author": {
    "@type": "Person",
    "name": "Your Name",
    "url": "https://yoursite.com/about"
  },
  "datePublished": "2025-12-30",
  "prepTime": "PT30M",
  "cookTime": "PT45M",
  "totalTime": "PT1H15M",
  "recipeCategory": "Main Course",
  "recipeCuisine": "Indian",
  "recipeYield": "4 servings",
  "keywords": "chicken tikka masala, indian curry, easy tikka masala, weeknight dinner",
  "nutrition": {
    "@type": "NutritionInformation",
    "calories": "485 calories",
    "fatContent": "22g",
    "saturatedFatContent": "8g",
    "carbohydrateContent": "18g",
    "fiberContent": "3g",
    "sugarContent": "8g",
    "proteinContent": "52g",
    "sodiumContent": "680mg",
    "cholesterolContent": "145mg"
  },
  "recipeIngredient": [
    "800g boneless chicken thighs, cut into chunks",
    "1 cup plain yogurt",
    "2 tablespoons lemon juice",
    "2 teaspoons ground cumin",
    "2 teaspoons paprika",
    "1 teaspoon turmeric",
    "1 teaspoon garam masala",
    "1 teaspoon salt",
    "2 tablespoons vegetable oil",
    "1 large onion, finely diced",
    "4 cloves garlic, minced",
    "1 tablespoon fresh ginger, grated",
    "1 can (400g) crushed tomatoes",
    "1 cup heavy cream",
    "Fresh cilantro for garnish"
  ],
  "recipeInstructions": [
    {
      "@type": "HowToStep",
      "name": "Marinate the Chicken",
      "text": "Combine yogurt, lemon juice, cumin, paprika, turmeric, garam masala, and salt in a large bowl. Add chicken pieces and coat well. Cover and refrigerate for at least 1 hour or overnight.",
      "image": "https://yoursite.com/images/step1-marinate.jpg"
    },
    {
      "@type": "HowToStep",
      "name": "Cook the Chicken",
      "text": "Heat oil in a large skillet over medium-high heat. Remove chicken from marinade and cook until browned on all sides, about 5-6 minutes. Set aside.",
      "image": "https://yoursite.com/images/step2-cook-chicken.jpg"
    },
    {
      "@type": "HowToStep",
      "name": "Make the Sauce",
      "text": "In the same pan, add onion and cook until softened. Add garlic and ginger, cook for 1 minute. Add crushed tomatoes and simmer for 15 minutes until thickened.",
      "image": "https://yoursite.com/images/step3-sauce.jpg"
    },
    {
      "@type": "HowToStep",
      "name": "Combine and Simmer",
      "text": "Return chicken to the pan. Stir in heavy cream and simmer for 15-20 minutes until chicken is cooked through and sauce is rich and creamy.",
      "image": "https://yoursite.com/images/step4-simmer.jpg"
    },
    {
      "@type": "HowToStep",
      "name": "Serve",
      "text": "Garnish with fresh cilantro and serve hot over basmati rice or with warm naan bread.",
      "image": "https://yoursite.com/images/step5-serve.jpg"
    }
  ],
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.8",
    "bestRating": "5",
    "ratingCount": "342",
    "reviewCount": "215"
  },
  "review": [
    {
      "@type": "Review",
      "author": {
        "@type": "Person",
        "name": "FoodLover99"
      },
      "datePublished": "2025-12-15",
      "reviewBody": "Best tikka masala recipe I've found online. The overnight marination makes all the difference!",
      "reviewRating": {
        "@type": "Rating",
        "ratingValue": "5",
        "bestRating": "5"
      }
    }
  ],
  "video": {
    "@type": "VideoObject",
    "name": "How to Make Chicken Tikka Masala",
    "description": "Step-by-step video tutorial for making authentic chicken tikka masala at home.",
    "thumbnailUrl": "https://yoursite.com/images/tikka-video-thumb.jpg",
    "uploadDate": "2025-12-30",
    "duration": "PT8M30S",
    "embedUrl": "https://www.youtube.com/embed/VIDEO_ID"
  }
};

WordPress Recipe Schema

/**
 * Output Recipe schema for WordPress recipe posts
 * Uses custom fields for recipe data
 */
function wp_recipe_schema() {
    if ( ! is_singular( 'post' ) ) {
        return;
    }

    global $post;

    // Check if post has recipe data
    $prep_time = get_post_meta( $post->ID, 'recipe_prep_time', true );
    if ( empty( $prep_time ) ) {
        return;
    }

    $cook_time   = get_post_meta( $post->ID, 'recipe_cook_time', true );
    $servings    = get_post_meta( $post->ID, 'recipe_servings', true );
    $category    = get_post_meta( $post->ID, 'recipe_category', true );
    $cuisine     = get_post_meta( $post->ID, 'recipe_cuisine', true );
    $calories    = get_post_meta( $post->ID, 'recipe_calories', true );
    $ingredients = get_post_meta( $post->ID, 'recipe_ingredients', true ); // Stored as array
    $steps       = get_post_meta( $post->ID, 'recipe_steps', true ); // Stored as array

    $schema = [
        '@context'       => 'https://schema.org',
        '@type'          => 'Recipe',
        'name'           => get_the_title(),
        'description'    => wp_trim_words( get_the_excerpt(), 30 ),
        'image'          => get_the_post_thumbnail_url( $post->ID, 'full' ),
        'author'         => [
            '@type' => 'Person',
            'name'  => get_the_author(),
        ],
        'datePublished'  => get_the_date( 'Y-m-d' ),
        'prepTime'       => 'PT' . $prep_time . 'M',
        'cookTime'       => 'PT' . $cook_time . 'M',
        'totalTime'      => 'PT' . ( (int) $prep_time + (int) $cook_time ) . 'M',
        'recipeCategory' => $category,
        'recipeCuisine'  => $cuisine,
        'recipeYield'    => $servings . ' servings',
    ];

    if ( $calories ) {
        $schema['nutrition'] = [
            '@type'    => 'NutritionInformation',
            'calories' => $calories . ' calories',
        ];
    }

    if ( is_array( $ingredients ) ) {
        $schema['recipeIngredient'] = $ingredients;
    }

    if ( is_array( $steps ) ) {
        $schema['recipeInstructions'] = array_map( function( $step, $index ) {
            return [
                '@type' => 'HowToStep',
                'name'  => 'Step ' . ( $index + 1 ),
                'text'  => $step,
            ];
        }, $steps, array_keys( $steps ) );
    }

    echo '<script type="application/ld+json">'
        . wp_json_encode( $schema, JSON_UNESCAPED_SLASHES )
        . '</script>' . "\n";
}
add_action( 'wp_head', 'wp_recipe_schema' );

Time Format Reference

// ISO 8601 Duration Format for recipe times
// PT = Period Time

// Examples:
// PT15M       = 15 minutes
// PT1H        = 1 hour
// PT1H30M     = 1 hour 30 minutes
// PT2H45M     = 2 hours 45 minutes
// P1D         = 1 day (for slow fermentation, etc.)
// P1DT12H     = 1 day 12 hours

Best Practices

  • Use multiple image aspect ratios — provide 1:1, 4:3, and 16:9 versions for different devices
  • Include nutrition — calorie count appears in recipe rich results
  • Add video — recipes with video get preferred placement in carousels
  • Use HowToStep for instructions — enables step-by-step display
  • Include aggregateRating — star ratings significantly boost click-through rate
  • List every ingredient in recipeIngredient — complete ingredient lists improve schema quality
  • Set accurate totalTime — Google displays this prominently in results

Features

  • Recipe Cards in SERP: Large visual cards with image, rating, and cooking time
  • Google Recipe Carousel: Appear in recipe carousel on mobile
  • Nutrition Display: Calorie count shown in search results
  • Step-by-Step: Structured instructions for Google Assistant cooking mode
  • Video Integration: Embed recipe video within schema
  • WordPress Ready: PHP implementation with custom field support

Related Snippets