Files
threadcount-community/components/JsonLd.tsx
T
ThreadCount 1bc2de655a ThreadCount Community edition
Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
2026-09-13 08:45:19 +10:00

10 lines
532 B
TypeScript

/* Emits a JSON-LD block.
*
* A server component, so the markup is in the HTML a crawler is served rather than something it
* has to execute JavaScript to discover. The JSON is serialised rather than templated, and `<`
* is escaped so a stray character in any content string can't close the script tag early. */
export default function JsonLd({ data }: { data: object }) {
const json = JSON.stringify(data).replace(/</g, "\\u003c");
return <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: json }} />;
}