Keep your existing Schema.org fields and add mosaicora:og semantic values for content the generator should render exactly. These overrides guide the Open Graph image without replacing normal page metadata.
MosaicoraOgJsonLd::serialize escapes less-than characters, so the result can be embedded safely as JSON-LD script text.
Build and serialize the override
use Mosaicora\PluginCore\MosaicoraOgJsonLd;
use Mosaicora\PluginCore\MosaicoraOgJsonLdOptions;
$jsonLd = MosaicoraOgJsonLd::build(new MosaicoraOgJsonLdOptions(
schemaType: "Product",
name: "Example product",
additionalFields: [
"offers" => ["@type" => "Offer", "price" => "49", "priceCurrency" => "USD"],
],
mosaicoraOg: [
"schemaVersion" => 3,
"semanticValues" => [
"content.title" => "Example product",
"content.description" => "A polished product preview.",
"product.price" => "$49",
"product.features" => ["Fast setup", "Consistent previews"],
],
],
));
$serializedJsonLd = MosaicoraOgJsonLd::serialize($jsonLd);
Embed with your template engine
Insert serialized JSON once as the text content of an application/ld+json script.
<script type="application/ld+json"><?= $serializedJsonLd ?></script>