seo: move site-wide JSON-LD from body to head (cherry-pick) - #609
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #608 from
devontomain.Scope
Single-file change in
src/app/layout.tsx. Moves the site-wide Organization + WebSite JSON-LD block from the first child of<body>into the root<head>.Rationale
Google parses JSON-LD in both
<head>and<body>. Stricter parsers (some AI search crawlers, schema validators) only scan<head>. Placing the Organization block (brand entity, logo, contactPoint, sameAs with Wikidata anchor, SearchAction) in<head>makes it visible to head-only parsers on every page.Pure placement change. Serialized JSON is byte-identical to the previous output.
Per-page JSON-LD scope note
Original brief included moving per-page Dataset/TechArticle/Breadcrumb/FAQPage blocks. Verified against
node_modules/next/dist/docs/01-app/02-guides/json-ld.mdandreact-domsource: inline<script>rendered from a page component cannot be hoisted to<head>in Next 16 + React 19 App Router (page renders inside body, React 19 only hoists<script src async>resource scripts,next/scriptwithbeforeInteractiveserializes to a__next_s.pushin body, metadataotherfield only emits<meta>,React.cacheis not shared between metadata and render). Per-page blocks remain in<body>. Google rich results coverage is unaffected.See #608 for the full verification matrix (head vs body counts per prerendered page).