Skip to content

Commit 296a742

Browse files
committed
fix(seo): emit literal \\u003c in JSON-LD, not a raw less-than
In JS source "\u003c" is the character "<", so the prior replace was a no-op. Use "\\u003c" so the serialized payload contains the six-character escape sequence and cannot close the script element early. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 21076ec commit 296a742

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const structuredDataItems = structuredData ? Array.isArray(structuredData) ? str
7676
<title>{title}</title>
7777

7878
{structuredDataItems.map((item) => (
79-
<script type="application/ld+json" set:html={JSON.stringify(item).replace(/</g, "\u003c")} />
79+
<script type="application/ld+json" set:html={JSON.stringify(item).replace(/</g, "\\u003c")} />
8080
))}
8181

8282
<script is:inline>

0 commit comments

Comments
 (0)