Adding JSON-LD to one page is a copy-and-paste job. Keeping it correct across 400 location pages, 60 service pages and a few hundred blog posts is an engineering problem. At that size, schema stops being a one-time task and becomes a data product: it has inputs, a build step, tests, owners, and a failure mode where it quietly drifts away from what the page actually says.
This guide covers the working model we use for multi-location and multi-service sites: generate markup from structured CMS data, prioritize the types that earn their keep, link every entity with a stable @id, validate in layers (including in CI), and put governance around it so it does not rot six months after launch.
Small sites fail at schema because of syntax. Large sites fail because of divergence. Three patterns cause almost every problem we see in audits:
- Hand-pasted blocks. Someone copies Austin's LocalBusiness block into the Dallas page and forgets to change the phone number, geo coordinates, or
url. Now two locations assert the same identity. - Plugin plus theme plus manual. An SEO plugin emits Organization, the theme emits its own, and a developer added a third. The page carries three conflicting versions of the same business.
- Content drift. A location changes its hours, a price goes up, a service is retired. The page body is updated; the JSON-LD is not, because it lives somewhere nobody looks.
Google's structured data guidelines say markup must represent content that is visible to users on the page. Drift is therefore not only a data-quality issue; it is a policy risk that can make a page ineligible for rich results or draw a manual action for misleading markup. The rest of this article is about designing the system so these failures are structurally hard to produce.
The core principle: schema is a rendering of your data, not a separate asset. If a location's name, address, phone, hours and coordinates already exist as fields in your CMS, database or spreadsheet feed, the JSON-LD should be computed from those same fields at render time. Nobody should ever edit the JSON by hand.
Structure it in three layers:
- Source of truth. One record per entity (location, service, author, article). Required fields are enforced at the CMS level so a location cannot be published without a phone number or address.
- Builder functions. One small function per schema type that accepts a record and returns a plain object. Builders omit any property whose value is empty rather than emitting empty strings or
null. - Page templates. Each template composes the builders it needs and serializes a single
@graphinto the page head.
// builders/localBusiness.js
export function localBusiness(loc, site) {
const node = {
"@type": loc.schemaType || "LocalBusiness",
"@id": `${site.origin}/locations/${loc.slug}/#localbusiness`,
name: loc.name,
url: `${site.origin}/locations/${loc.slug}/`,
telephone: loc.phoneE164,
address: {
"@type": "PostalAddress",
streetAddress: loc.street,
addressLocality: loc.city,
addressRegion: loc.region,
postalCode: loc.postalCode,
addressCountry: loc.country
},
parentOrganization: { "@id": `${site.origin}/#organization` }
};
if (loc.lat && loc.lng)
node.geo = { "@type": "GeoCoordinates", latitude: loc.lat, longitude: loc.lng };
if (loc.hours?.length)
node.openingHoursSpecification = loc.hours.map(toHoursSpec);
return node;
}
// serialize safely
const json = JSON.stringify({ "@context": "https://schema.org", "@graph": nodes })
.replace(/</g, "\\u003c");
The final replace matters. Any CMS string that contains </script> would otherwise terminate the block early and produce unparsable markup, which Search Console reports as an error on that URL.
Render server-side, not via client-side injection. Google can process JSON-LD added by JavaScript, but many other consumers, including some AI crawlers and link-preview bots, do not execute scripts reliably. Server-rendered markup is also easier to test, because the HTML you fetch is the HTML Google sees.
Not every schema type deserves engineering time. Rich result eligibility has also narrowed: Google restricted FAQ rich results to a small set of authoritative government and health sites in 2023 and retired HowTo rich results, so those types should not be a rollout priority for a typical service business. Order the work by how much the type helps Google, and AI systems, understand and trust your business entity. For the FAQ question specifically, this look at what FAQ schema still does in 2026 explains when it is worth the effort.
| Priority | Type | Where it lives | Why |
|---|---|---|---|
| 1 | Organization / WebSite | Every page (via shared @id), full node on home | Anchors your brand entity, logo, and social profiles |
| 2 | LocalBusiness (or a specific subtype) | Each location page | Name, address, phone, hours, geo that must match Google Business Profile |
| 3 | Service | Each service and service-area page | Connects what you do to who provides it and where |
| 4 | BreadcrumbList | All templated pages | Cheap, template-driven, stable |
| 5 | Article / BlogPosting + Person | Blog and guides | Authorship and freshness signals |
| 6 | Review / AggregateRating | Only where genuinely eligible | High risk, see below |
Use the most specific subtype available (Plumber, HVACBusiness, Electrician, RoofingContractor, Dentist) rather than generic LocalBusiness, but only where the subtype honestly describes the business. Reviews deserve special caution: Google does not allow self-serving review markup for LocalBusiness or Organization entities, so marking up your own testimonials on your own location pages is a common reason a site's review snippets are ignored.
If you need a clean starting skeleton to turn into a builder, our schema generator produces valid LocalBusiness and Service markup you can use as a reference output.
Because the builders and the page body read from the same record, most drift disappears by construction. What remains falls into three cases you should handle deliberately.
Derived values. Hours are the classic case. If the visible page says "Closed Sundays" but the JSON-LD omits Sunday, that is consistent; if the page shows "Open 24 hours" and the JSON-LD lists 9 to 5, it is not. Generate the human-readable text and the openingHoursSpecification from the same hours object so they cannot disagree. Handle holiday overrides in that object too, using validFrom and validThrough.
Content that exists only in markup. If a field is not shown to visitors (an internal priceRange guess, a rating nobody can see), do not publish it. A useful rule for reviewers: every value in the JSON-LD should be findable on the rendered page, or be a pure identifier such as @id or a URL.
Fields owned by external systems. If review counts or ratings come from a third-party platform, pull them through the same data pipeline, with a freshness limit. If the sync fails for a week, the builder should drop the rating node entirely rather than serve stale numbers.
A practical parity check compares fields from the JSON-LD against the visible HTML after rendering. For each location page, assert that the telephone, street address and city from the markup appear in the page text. It is a blunt test, and it catches most real-world drift.
The feature that separates a clean implementation from a pile of disconnected blocks is the @id. It gives each entity a stable, globally unique identifier so that other nodes, on this page or on any other page, can reference it instead of redefining it.
Rules that hold up across thousands of URLs:
- Use an absolute URL plus a fragment:
https://example.com/locations/austin/#localbusiness. The fragment keeps the identifier from colliding with the page URL itself. - Derive it from an immutable key (a slug that never changes, or a database ID), never from a title or a name that marketing may edit.
- Define the full node once, on the canonical page for that entity. Everywhere else, reference it with just
{ "@id": "..." }. - Keep the pattern identical across environments except for the origin, so staging data never leaks production identifiers.
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://example.com/#organization",
"name": "Example Plumbing Co.",
"url": "https://example.com/",
"logo": "https://example.com/img/logo.png"
},
{
"@type": "Plumber",
"@id": "https://example.com/locations/austin/#localbusiness",
"name": "Example Plumbing Co. - Austin",
"parentOrganization": { "@id": "https://example.com/#organization" }
},
{
"@type": "Service",
"@id": "https://example.com/services/water-heater-repair/#service",
"name": "Water Heater Repair",
"provider": { "@id": "https://example.com/locations/austin/#localbusiness" },
"areaServed": { "@type": "City", "name": "Austin" }
}
]
}
Notice the Service node does not redefine the business. It points at it. When the Austin phone number changes, you update one record and every page that references that entity inherits the fix. Your breadcrumb, article and author nodes follow the same pattern: publisher references the Organization, author references a Person node defined on the author's profile page, and isPartOf references the WebSite.
A subtle failure mode is a dangling reference: a node points at an @id that no page ever defines in full. Search engines treat that as a hole in the graph, and your QA pipeline should detect it (more below).
No single tool is enough. Each one answers a different question, so use them in layers, cheapest first.
- Syntax and shape (unit tests, every commit). Parse the generated JSON, then validate each node against a lightweight JSON Schema you maintain per type: required properties, value formats (ISO 8601 dates, E.164 phone numbers, numeric prices, absolute URLs). This is where a library like Ajv earns its place.
- Graph integrity (CI on a staging build). Crawl a sample, collect every JSON-LD node, and assert that every
@idis unique, every{ "@id": ... }reference resolves to a fully defined node somewhere, and each location has exactly one primary LocalBusiness entity. - Vocabulary check (spot checks). The Schema Markup Validator at validator.schema.org checks that your markup is valid against the schema.org vocabulary, regardless of Google's feature rules.
- Eligibility check (spot checks). Google's Rich Results Test tells you whether a specific URL qualifies for a Google feature, and shows what Googlebot actually rendered. It is slow and manual, so run it on one representative URL per template, not on thousands of pages.
- Production monitoring. Search Console's enhancement and rich result reports show what Google actually parsed across the whole site, with trends over time.
The key scaling idea is test per template, crawl per site. Because pages are generated from builders, one passing Rich Results Test on a location template with realistic data is strong evidence about all of them, provided your data validation covers edge cases such as missing optional fields. A nightly crawl then covers the long tail.
// ci/schema-check.mjs (simplified)
import Ajv from "ajv";
const ids = new Map(), refs = [];
for (const page of await crawlStaging(sampleUrls)) {
for (const node of page.jsonLdNodes) {
if (!validate[node["@type"]]?.(node)) fail(page.url, node["@id"]);
if (node["@id"]) {
if (ids.has(node["@id"]) && ids.get(node["@id"]) !== page.url)
fail("duplicate @id", node["@id"]);
ids.set(node["@id"], page.url);
}
collectRefs(node, refs);
}
assertVisible(page.text, page.primaryLocation); // phone, street, city
}
for (const r of refs) if (!ids.has(r)) fail("dangling @id", r);
Make the job block merges on failure for the high-priority types, and warn-only for lower-priority ones so the pipeline does not get disabled out of frustration. Before wiring all this up, a quick website SEO audit can show you which templates currently emit duplicate or conflicting blocks, which tells you where to point the first tests.
Search Console distinguishes between invalid items (errors that block eligibility), items with warnings (eligible, but missing recommended fields), and unparsable structured data (the markup could not even be read). These are the causes we see most often at scale:
- Unparsable JSON. Trailing commas, unescaped quotes or line breaks in descriptions, or a CMS string containing
</script>. Fix: serialize with a real JSON encoder, never string concatenation. - Missing required fields. For example, a LocalBusiness without
nameoraddress, or a Product with nooffers. Fix: enforce required fields at the CMS level and have builders refuse to emit a node that fails validation. - Wrong value types. Price written as "$49.99" instead of
49.99withpriceCurrency, dates not in ISO 8601, relative image URLs, ratings passed as strings with text. Fix: normalize in the builder. - Rating without support. An
aggregateRatingwith noratingCountorreviewCount, or ratings that are not visible on the page. Fix: only emit when both the data and the visible content exist. - Conflicting duplicates. Plugin and theme both emit Organization with different logos or names. Fix: pick one source of schema output per site and disable the rest.
- Non-eligible types. Markup that is syntactically valid but for a feature Google no longer shows (FAQ and HowTo for most sites). It does not trigger errors, but it is dead weight and can mask real issues in reports.
When an enhancement report spikes, group affected URLs by template first. A sudden jump in invalid items almost always traces back to one builder or one data field, not hundreds of independent mistakes. Use "Validate fix" in Search Console only after the change is deployed, since validation re-checks live URLs.
Technical pipelines fail slowly when nobody owns them. A few lightweight governance habits are what keep a schema program healthy for years rather than quarters.
- Single owner and single source. Name one team responsible for the builders, and keep them in version control with code review. Disable every other source of JSON-LD (plugins, theme defaults, tag manager injections) so there is only one writer.
- A schema registry. A short document, kept next to the code, listing each type you ship, which templates use it, the required fields, the
@idpattern, and the reason it exists. If you cannot justify a type in a sentence, remove it. - Change management. Treat a change to a builder like a change to a public API. Include a sample diff of generated output in the pull request, so reviewers see the actual JSON impact.
- Data hygiene hooks. When a location is opened, closed or renamed, the process should update the CMS record, redirect or retire the page, and let the
@idreferences update automatically. Closed locations should stop emitting active LocalBusiness markup; if appropriate, usepermanentlyClosedstatus on the entity rather than silent deletion. - Monitoring cadence. Weekly glance at Search Console enhancement reports for new errors, a nightly or weekly crawl running the graph checks, and a quarterly review of Google's structured data documentation for changes to eligibility, since feature support does change.
The payoff of this discipline is boring in the best way: new locations launch with correct markup on day one, a phone number change is a single edit, and the Search Console report stays flat instead of surprising you every quarter.
Should I generate JSON-LD with a plugin or custom code at scale?
At small scale a well-configured plugin is fine. Across hundreds of location and service pages, custom builders fed by your CMS data give you more control over @id patterns, required-field enforcement and testing. Whichever you choose, run exactly one writer of schema per page, because stacked plugin, theme and manual output creates conflicting duplicate entities.
How many pages should I test with the Rich Results Test?
Test one representative URL per template, using realistic data including edge cases like missing optional fields, rather than thousands of individual pages. The tool is manual and slow. Pair it with automated JSON Schema validation and a scheduled crawl in CI, which checks every generated page for syntax, duplicate or dangling @id values, and visible-content parity.
Do I need the same @id on every page that mentions a business?
Yes. Define the full entity once on its canonical page, then reference the identical @id from every other node that relates to it, such as Service providers or Article publishers. Use an absolute URL with a fragment built from an immutable key, so renames of titles or slugs do not break the links between entities.
Why does Search Console say my structured data is invalid after a template change?
Template changes usually alter one builder or data field, so errors appear across all pages using it at once. Group affected URLs by template, inspect one in the Rich Results Test, and look for missing required properties, wrong value types or empty strings. Deploy the fix, then use Validate fix so Google re-checks the live URLs.
Is FAQ or HowTo schema still worth adding across my site?
For most service businesses it is low priority. Google limited FAQ rich results to a small set of authoritative government and health sites and retired HowTo rich results, so the markup rarely produces a visible feature. Spend that effort on Organization, LocalBusiness, Service and breadcrumb markup, which strengthen entity understanding and are reliably maintainable.
Turn this into a practical SEO action plan
Use RankLocalToday tools to check rankings, diagnose website issues, and prioritize the next organic traffic move.
Get your SEO plan →More in this topic: Website SEO, all 208 guides →