Signal and noise in recipe markup
Structured data is the part of a food site that earns its traffic. Here is the shape of it.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Recipe",
"name": "Cacio e pepe",
"recipeYield": "2 servings"
}
</script>
And the PHP that emits it:
<?php
if ( $a < $b && $b > 0 ) {
echo '<span class="qty">' . esc_html( $qty ) . '</span>';
}
?>
A JavaScript template literal containing markup, which is where most escaping bugs finally surface:
const row = `<li>${qty} × ${item}</li>`;
if (a && b) render(row);
Every angle bracket above is stored as < or >. A converter that HTML-unescapes one step too eagerly turns these samples into markup and destroys them silently.
