Creamy Swiss Green Bean Bake
minRating = 1;
const maxRating = 5;
const ratingValue = Math.max(minRating, Math.min(maxRating, averageRating));
// Ensure reviewCount is positive
const validatedReviewCount = reviewCount > 0 ? reviewCount : 1; // Default to 1 if no valid reviews
// Build JSON-LD schema
const schema = {
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Swiss Cheese Green Bean Casserole",
"image": "https://cdn.shopify.com/s/files/1/0585/9013/4355/files/easychef-pro-recipe-creamy-swiss-green-bean-bake-36373264236627.jpg?v=1736926023",
"description": "A beloved holiday dish with fresh green beans, Swiss cheese, and a crunchy cornflake topping.",
"prepTime": "PT35M",
"totalTime": "PT55M",
"recipeIngredient": [
"1.5 Pounds fresh green beans, steamed",
"2 Tablespoons butter, melted",
"2 Tablespoons all-purpose flour",
"2 Tablespoons onion, grated",
"1 Teaspoon white sugar",
"1 Teaspoon salt",
"2 Cups sour cream",
"8 Ounces Swiss cheese, shredded",
"2 Cups corn flakes, crushed",
"2 Tablespoons butter, melted"
],
"recipeInstructions": [
"Preheat your oven to 400 degrees F (200 degrees C).",
"Place a steamer insert into a saucepan and fill with water just below the bottom of the steamer. Bring the water to a boil. Add the green beans, cover, and steam until slightly tender, about 5 minutes.",
"In a saucepan over medium heat, stir together 2 tablespoons of melted butter, flour, onion, sugar, and salt. Gradually stir in the sour cream. Cook and stir the mixture until hot, thickened, and smooth, about 10 minutes.",
"Add the steamed green beans to the cream mixture. Pour the green bean-cream mixture into a 2-quart casserole dish and sprinkle with Swiss cheese.",
"Mix the corn flakes and 2 tablespoons of melted butter in a bowl until well coated. Sprinkle over the Swiss cheese layer.",
"Bake in the preheated oven until the cheese is bubbling and the topping is browned, about 20 minutes."
],
"recipeCategory": "Side Dish",
"recipeCuisine": "American",
"keywords": "Green Bean Casserole, Vegetarian, Holiday Dish, Swiss Cheese, Comfort Food",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": ratingValue.toFixed(1), // Ensure one decimal place
"reviewCount": validatedReviewCount, // Positive integer
"bestRating": maxRating.toString(),
"worstRating": minRating.toString()
}
};
// Inject JSON-LD script into the page
const scriptTag = document.createElement("script");
scriptTag.type = "application/ld+json";
scriptTag.textContent = JSON.stringify(schema);
document.head.appendChild(scriptTag);
}
});