14 lines
470 B
TypeScript
14 lines
470 B
TypeScript
|
|
// Renders a JSON-LD structured-data script. The `<` escape prevents a
|
||
|
|
// `</script>` sequence in the data from breaking out of the tag.
|
||
|
|
export function JsonLd({ data }: { data: object }) {
|
||
|
|
return (
|
||
|
|
<script
|
||
|
|
type="application/ld+json"
|
||
|
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: JSON-LD must be injected as a raw script.
|
||
|
|
dangerouslySetInnerHTML={{
|
||
|
|
__html: JSON.stringify(data).replace(/</g, '\\u003c'),
|
||
|
|
}}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|