function generateRecipeSchema(recipe) { return { "@context": "https://schema.org/", "@type": "Recipe", "name": recipe.title, "author": { "@type": "Person", "name": recipe.creatorName }, "image": recipe.imageUrl, "description": recipe.description, "datePublished": recipe.publicationDate, "prepTime": `PT\${recipe.prepTime}M`, "cookTime": `PT\${recipe.cookTime}M`, "totalTime": `PT\${recipe.totalTime}M`, "recipeYield": recipe.servings, "recipeIngredient": recipe.ingredients, "recipeInstructions": recipe.instructions, "video": { "@type": "VideoObject", "name": recipe.videoTitle, "description": recipe.videoDescription, "thumbnailUrl": recipe.thumbnailUrl, "uploadDate": recipe.uploadDate, "duration": `PT\${recipe.videoDuration}`, "contentUrl": recipe.videoUrl }, "publisher": { "@type": "Organization", "name": "FoodTokTV", "logo": recipe.logoUrl }, "isPartOf": { "@type": "TVSeries", "name": recipe.showName, "episode": recipe.episodeNumber }, "inLanguage": recipe.languages, "alternateName": recipe.alternateTitle, "description": { "en": recipe.englishDescription, "es": recipe.spanishDescription } }; } // Example usage: const sampleRecipe = { title: "Homemade Irish Cream", creatorName: "Caz", imageUrl: "https://example.com/image.jpg", description: "A delicious homemade Irish cream recipe.", publicationDate: "2025-02-05", prepTime: 10, cookTime: 5, totalTime: 15, servings: "4 servings", ingredients: ["1 cup cream", "1 cup whiskey", "1 can sweetened condensed milk"], instructions: ["Mix all ingredients", "Chill and serve"], videoTitle: "How to Make Homemade Irish Cream", videoDescription: "Step-by-step guide to making Irish cream.", thumbnailUrl: "https://example.com/thumbnail.jpg", uploadDate: "2025-02-05", videoDuration: "PT5M", videoUrl: "https://example.com/video.mp4", logoUrl: "https://example.com/logo.jpg", showName: "Sunday Night Live", episodeNumber: "12", languages: ["en", "es"], alternateTitle: "Crema Irlandesa Casera", englishDescription: "A delicious homemade Irish cream recipe.", spanishDescription: "Una deliciosa receta de crema irlandesa casera." }; const schemaMarkup = generateRecipeSchema(sampleRecipe); console.log(JSON.stringify(schemaMarkup, null, 2));