feat: adding the rest ofthe nutrition properties from schema.org (#4301)

This commit is contained in:
Tom Brennan
2024-10-13 09:04:29 -04:00
committed by GitHub
parent 3aea229f2d
commit 02c0fe993b
16 changed files with 279 additions and 57 deletions

View File

@@ -104,15 +104,7 @@ def content_with_meta(group_slug: str, recipe: Recipe) -> str:
ingredients.append(s)
nutrition: dict[str, str | None] = {}
if recipe.nutrition:
nutrition["calories"] = recipe.nutrition.calories
nutrition["fatContent"] = recipe.nutrition.fat_content
nutrition["fiberContent"] = recipe.nutrition.fiber_content
nutrition["proteinContent"] = recipe.nutrition.protein_content
nutrition["carbohydrateContent"] = recipe.nutrition.carbohydrate_content
nutrition["sodiumContent"] = recipe.nutrition.sodium_content
nutrition["sugarContent"] = recipe.nutrition.sugar_content
nutrition: dict[str, str | None] = recipe.nutrition.model_dump(by_alias=True) if recipe.nutrition else {}
as_schema_org = {
"@context": "https://schema.org",