Files
spsays-training/components/seo/json-ld.tsx
T

15 lines
405 B
TypeScript

/**
* Renders a schema.org JSON-LD <script>. Safe in server or client components.
* The `<` escape prevents the JSON from breaking out of the <script> element.
*/
export function JsonLd({ data }: { data: object | object[] }) {
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(data).replace(/</g, "\\u003c"),
}}
/>
);
}