Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(schema): escape JSON-LD at the HTML script boundary

Rudy Celekliee4b2e351d4b
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index ea384a9..a6f60db 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -6,7 +6,7 @@
},
"metadata": {
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",
- "version": "2.11.17",
+ "version": "2.11.18",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 83527da..d155ceb 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.17",
+ "version": "2.11.18",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 7f59e6e..5884655 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.17",
+ "version": "2.11.18",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index 404f2de..806f04c 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -47,7 +47,7 @@ Current versions of all skills. Agents can compare against local versions to che
| referrals | 2.0.2 | 2026-10-02 |
| revops | 2.0.1 | 2026-10-02 |
| sales-enablement | 2.3.2 | 2026-10-02 |
-| schema | 2.0.0 | 2026-05-05 |
+| schema | 2.0.1 | 2026-10-06 |
| seo-audit | 2.0.1 | 2026-08-19 |
| signup | 2.0.0 | 2026-05-05 |
| site-architecture | 2.0.0 | 2026-05-05 |
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.18 (2026-10-06)
+
+- **schema** (2.0.0 → 2.0.1): escape serialized JSON-LD at the HTML script boundary in the Next.js example, preserving the original product text. Add a matching diagnostic eval and link official framework guidance.
+
### 2.11.17 (2026-10-02)
- **video** (2.2.0 → 2.2.1) and the **Hyperframes integration guide** (reported in #600 by @pjthegiant): the old example called a `render({ frames })` API that the `hyperframes` package doesn't export. Both now lead with the CLI (`npx hyperframes init`, `preview`, `render -o output.mp4`) and explain the composition format: a root with `data-composition-id`, `class="clip"` elements with timing attributes, and a paused GSAP timeline. Rendering from code goes through `@hyperframes/producer` (`createRenderJob` + `executeRenderJob`). Checked against v0.8.114.
diff --git a/skills/schema/SKILL.md b/skills/schema/SKILL.md
index e601213..637f193 100644
--- a/skills/schema/SKILL.md
+++ b/skills/schema/SKILL.md
@@ -2,7 +2,7 @@
name: schema
description: When the user wants to add, fix, or optimize schema markup and structured data on their site. Also use when the user mentions "schema markup," "structured data," "JSON-LD," "rich snippets," "schema.org," "FAQ schema," "product schema," "review schema," "breadcrumb schema," "Google rich results," "knowledge panel," "star ratings in search," or "add structured data." Use this whenever someone wants their pages to show enhanced results in Google. For broader SEO issues, see seo-audit. For AI search optimization, see ai-seo.
metadata:
- version: 2.0.0
+ version: 2.0.1
---
# Schema Markup
diff --git a/skills/schema/evals/evals.json b/skills/schema/evals/evals.json
index 684edf2..51cdd4b 100644
--- a/skills/schema/evals/evals.json
+++ b/skills/schema/evals/evals.json
@@ -82,6 +82,19 @@
"Does not attempt full SEO audit using schema markup patterns"
],
"files": []
+ },
+ {
+ "id": 7,
+ "prompt": "Our Next.js product page embeds JSON-LD with dangerouslySetInnerHTML and JSON.stringify(schema). Product names come from a CMS and can contain HTML, quotes, ampersands and Unicode. How do we keep product text intact without allowing it to terminate the JSON-LD script element?",
+ "expected_output": "Should use the schema implementation example and escape the serialized JSON for its HTML script context by replacing every less-than character with a literal JSON Unicode escape before assigning __html. Should explain that JSON.stringify alone does not protect the HTML parser boundary, preserve the original product text when JSON is parsed, and avoid deleting content, HTML-entity escaping JSON or directly interpolating raw names. Should refer to the current official Next.js guidance.",
+ "assertions": [
+ "Identifies the script element HTML parsing boundary",
+ "Escapes every less-than character after JSON serialization",
+ "Preserves original product text after JSON.parse",
+ "Does not treat JSON.stringify alone as safe HTML embedding",
+ "Uses the linked Next.js guidance"
+ ],
+ "files": []
}
]
}
diff --git a/skills/schema/references/schema-examples.md b/skills/schema/references/schema-examples.md
index 2987e9e..d84b353 100644
--- a/skills/schema/references/schema-examples.md
+++ b/skills/schema/references/schema-examples.md
@@ -388,7 +388,7 @@ export default function ProductPage({ product }) {
<Head>
<script
type="application/ld+json"
- dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(schema).replace(/</g, '\\u003c') }}
/>
</Head>
{/* Page content */}
@@ -396,3 +396,5 @@ export default function ProductPage({ product }) {
);
}
```
+
+When JSON-LD is inserted as raw HTML, JSON escaping alone does not stop a product string containing a script-closing tag from terminating the element. Escape every `<` in the serialized JSON as `\u003c`, as in the example above; parsing the JSON recovers the original product text. Do this at the HTML embedding boundary, without deleting legitimate characters from the source data. See the [Next.js JSON-LD guide](https://nextjs.org/docs/app/guides/json-ld).