Menu

One Space Broke the JSON-LD Headline on 62 Pages
πŸ“°

One Space Broke the JSON-LD Headline on 62 Pages

DEV Community: webdevΒ·Katia BelokonΒ·8 days ago
#2kuDgO5Q
#devtowebdev#devto#dev#html#const
Reading 0:00
15s threshold

One of my page headings, Your <em>IP</em>, plainly , showed up in the JSON-LD as "Your IP , plainly" . The same bug was in the structured data of 62 pages. On screen, every one of them looked right.

The site is MyIPScan, which I built. This post is about the bug class, how it happens, and a test that catches it.

TL;DR

If you derive a JSON-LD headline from heading HTML, inline tags like <em> can leave a space before punctuation: Your <em>IP</em>, plainly β†’ Your IP , plainly .

Fix: delete inline tags without replacing them, and turn only block boundaries into spaces.

Catch it at build time: the JSON-LD headline must equal the visible heading's normalized text, and no generated text field may match / [,.;:!?)]/ .

Why one space matters

JSON-LD is a copy of your page written for machines, and no human reads it.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.