A Duplicate @id Was Quietly Shadowing My Best Schema

A Duplicate @id Was Quietly Shadowing My Best Schema

BackerLeader ●2 ●11 ●63
calendar_today ago • schedule4 min read

My best-structured page was shipping an empty list under an @id that already belonged to another node. Nothing errored. Google still showed rich results. And if a machine had asked my site "how many genres do you cover?", the empty list could have answered first.

Here is how a duplicate @id happens on a real site, what it almost cost me, and the census that caught it.

The setup: two JSON-LD sources on one page

The DJ Calendar (thedjcalendar.com) is a 1,000+ page tour directory I have been building for a decade. Every page carries structured data, and my genre directory - /genres/ - carries the best of it: a complete @graph with the site organization, a dated WebPage node, breadcrumbs, and an ItemList of six curated genre hubs, each with a name and a URL.

That graph is generated by a shared SEO module. But the page template that renders /genres/ ALSO prints its own inline JSON-LD block, added months earlier during a separate pass. Two blocks, one head, nobody noticing - because each block alone validates.

The bug

The inline block declared:

{
"@type": "CollectionPage",
"@id": "https://thedjcalendar.com/genres/#webpage",
"mainEntity": {

"@type": "ItemList",
"name": "Electronic Music Genres",
"itemListElement": []

}
}

Two problems, stacked.

First: #webpage was already taken. The good graph's WebPage node uses exactly that @id. Now two nodes on one page claim to be the same entity - one with dates, speakable selectors, and a breadcrumb; the other with an empty list.

Second: the empty list. itemListElement: [] is not "no data", it is a machine-readable claim of zero items. Entity resolution is not a validator. When a consumer resolves @ids, a later duplicate can shadow the richer node - and what survives is the version that says the site covers zero genres.

The page rendered perfectly. Lighthouse had no complaints. The schema validator passed both blocks independently. Only a collision check between them could see the problem.

The census that found it

I almost did not look. My notes said the gap in the genre system was "six partial BlogPosting entries" from an audit weeks ago. I re-crawled all twelve hub pages before acting on that note - and found the note was stale. There were zero BlogPosting nodes anywhere. What the crawl found instead was worse:

  • /genres/ had the duplicate-@id collision and the empty list
  • The six /tag/ hub pages shipped their upcoming-shows ItemList as ~214 bare URLs - no @id, no name, no count. "214 upcoming shows" was visible in the page description but not citable from the list node itself
  • The six /genre/ pages had an artist CollectionPage with no @id, no dates, and no linkage into the site graph
    Lesson one, learned the hard way twice now: a recorded gap is a hypothesis. Re-census before acting on it.

The fix: one worker, three files

I ship changes to both my sites through token-gated, needle-guarded PHP patch workers - each one aborts unless every anchor appears exactly once, lints the result, verifies the payload actually landed, and self-deletes. For this fix, one worker patched three template files:

genres.php - the collision. The inline block's @id moved from #webpage to #collection, and instead of an empty list, its mainEntity became a reference to the real one:

"mainEntity": { "@id": "https://thedjcalendar.com/genres/#genres" }

One @id per entity now. The reference points at the list that has six named items.

genre.php - the artist CollectionPage got @id ...#collection, isPartOf pointing at the site graph, a breadcrumb reference, and a dateModified pulled from the same function that timestamps every other page. Its artist ItemList got an @id (#genre-artists) and a real numberOfItems.

tag.php - the shows ItemList got @id #upcoming-shows, a name ("Upcoming House shows"), and numberOfItems computed from the same array that renders the page. The count a human reads now matches the count a machine reads, because they are the same count.

One deliberate omission: I did not add itemListOrder to the show lists. The property would be free metadata - but I have not verified the actual ordering of those rows, and AGO has a rule about that: never publish a fact you have not checked, even a fact that looks like decoration.

The verify: 13 pages, strict-parsed

After the patch: fresh cache-busted fetches of all thirteen pages (the directory, six /genre/ pages, six /tag/ hubs), every JSON-LD block parsed strictly, and per-page assertions:

  • exactly one #upcoming-shows ItemList per hub, numberOfItems equal to its own item count
  • no anonymous ItemList left anywhere
  • each #collection node linked into the site graph with dates
  • zero CollectionPages still sitting at #webpage
  • the real six-item #genres list untouched
    Thirteen for thirteen. The collision is gone, and the empty list cannot shadow anything, because it no longer exists.

What I would tell a past me

  1. A validator is not a collision checker. Two blocks can each be perfect and still fight each other over an @id.
  2. An empty list is a citable fact. itemListElement: [] says "zero". If you cannot fill it, reference the list that has data - or delete the node.
  3. Every list gets an @id, a name, and a count. If your page says a number in prose, the list node should say the same number.
  4. Notes rot. Re-census before you trust your own audit trail.
    The receipts ledger for this deploy is public at bryanhamilton.info/receipts/ - every change I ship to either site is logged and verified against the served bytes, because a fix you cannot re-verify is a claim you cannot keep.

Want more #webdev & #seo deep dives?

Join 6,098+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

When One Python Process Fails, You Need to See All of Them

Tom Smithverified - Nov 23

Free SEO Tools Every Small Business Should Use (2026) | FloxoLab

floxolab - Oct 20

SEO Rates Philippines 2026: Costs & Packages | FloxoLab

floxolab - Oct 18

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Cloudflare Blocked My Server, So I Made My Visitors' Browsers Do the Fetching

bryanhamiltondevverified - Nov 15
chevron_left
3.8k Points • 76 Badges
Rochelle Park, New Jersey, US • bryanhamilton.info
35Posts
42Comments
36Connections
Full-stack web engineer · PHP & vanilla JS · 25+ years · Founder of The DJ Calendar · Open to work

Commenters (This Week)

9 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!