Engineering

Gatsby SEO: Structured Data and i18n Without Wrecking Your SERPs

Searching for “gatsby seo”. This guide explains how to make Gatsby SEO work with structured data and i18n without breaking indexing, canonicals, or hreflang.

Sep 3, 2026· 10 min read· Stack Innovations
Abstract layered blocks and branching paths in charcoal, off-white, and acid lime.
Structured data and multilingual routing introduce architectural choices that matter just as much as performance for Gatsby SEO.

Searching for “gatsby seo” often starts with a straightforward brief. Build a fast marketing site and add page titles. Publish a sitemap, then move on.

That plan changes as soon as the site has multiple languages, product or service templates, and structured data. A page can look correct in a browser while its canonical points to the wrong locale. A JSON-LD block can appear in the client DOM but not in the initial HTML. A sitemap can contain URLs that disagree with the canonical tags.

Fast pages help. They don't settle those problems.

What “Gatsby SEO ready” should actually mean

A Gatsby site is SEO ready when its important signals are present in the rendered HTML, generated from the right content, and kept consistent across every route and locale.

That means page titles and descriptions are correct. Canonicals identify the intended URL. Structured data describes the actual page. Sitemaps contain indexable URLs. Language annotations match the routing system. These signals should agree rather than being assembled by separate plugins with separate assumptions.

Gatsby provides built-in support for page metadata and JSON-LD. Its production build process renders pages on the server, which gives crawlers access to the HTML and head elements without waiting for browser-side JavaScript. Gatsby's official SEO documentation explains this support and shows how to add metadata and structured data through the page head.

That's a useful starting point, not a complete SEO architecture.

Static HTML doesn't automatically make structured data accurate. A build can generate valid HTML with an inaccurate product name or incomplete breadcrumb. It can also use a schema type that doesn't describe the page. Multiple locales add another layer. The same template needs different titles, canonicals, alternate links, and sometimes different organization or product details.

Build speed also isn't the same as indexing quality. A fast build that publishes conflicting signals still creates cleanup work for search engines and for your team.

A genuinely capable Gatsby build therefore needs a data model for SEO. It needs a defined source for locale, route, page type, and alternate URLs. It also needs a way to test the generated output before release.

How Gatsby’s Head API really renders for crawlers

Gatsby's Head API lets a page or template export a Head function. Gatsby calls that function during the build and places the returned elements into the document head. In production, those elements are part of the server-rendered HTML.

That distinction matters.

If a title or JSON-LD block is present in view-source, it exists in the initial document delivered to a crawler. If it appears only in the Elements panel after JavaScript runs, it was added or changed in the client DOM. Those aren't equivalent debugging results.

The Gatsby SEO documentation describes the server-rendering behaviour behind Gatsby's SEO support. The practical check is simple. Open the published URL, inspect the source, and search for the title, canonical, alternate links, and JSON-LD. Don't rely only on browser developer tools.

Several common implementation mistakes produce misleading results.

A component may set metadata inside useEffect, so the browser eventually shows the right title while the initial HTML does not. A layout can add a title while a page template adds another. Two plugins can emit separate canonical tags. One canonical may be generated from the current path while another points to a default site URL.

Search engines may choose between conflicting signals. Developers also lose time debugging the wrong output because the browser shows the final DOM rather than the HTML Gatsby generated.

Patrick Stox documents these common Gatsby SEO mistakes, including client-only metadata, duplicate canonicals, sitemap problems, and plugin maintenance issues. These aren't merely cosmetic defects. They make it harder to establish which URL and which page description Gatsby is actually publishing.

A clean setup gives each element one owner. The page or template owns its SEO data. The Head API renders it. A shared helper formats it. No client-side effect should be needed for indexable metadata.

Intersecting abstract grids with a single highlighted connection in acid lime.
Canonical tags, hreflang, and sitemaps need a single source of truth so Gatsby outputs consistent SEO signals.

Structured data at scale. Single source of truth or schema chaos

JSON-LD should come from page data, not from repeated blocks copied into individual templates.

A service page might receive its name, description, image, breadcrumb path, and organization reference through Gatsby's data layer. A blog template can receive article details and author data. A product template can receive catalog fields. The schema builder then turns that data into the appropriate JSON-LD object.

This approach makes changes traceable. If the organization name changes, you update the source data or schema helper rather than searching through page components for hardcoded strings.

The same principle applies to relationships. A breadcrumb should use the actual route hierarchy. An article schema should use the published page's author and date. A product schema shouldn't quietly inherit values from a generic site setting.

The risk increases when several SEO plugins are installed together. One may output basic metadata. Another may add WebSite or Organization schema. A template may add its own Article or Product object. An inline override then adds a second canonical or a second breadcrumb.

The result can be valid JSON that is still poor page data. A collection may have an ItemList without the expected item URLs. A product catalog may contain incomplete offers. A blog archive may carry article schema that belongs on individual posts. Search engines then receive partial or conflicting descriptions of the page.

Gatsby's data layer is useful because it gives templates structured access to content and page context. The official Gatsby SEO guidance shows the general pattern for using data with metadata and JSON-LD. At scale, the engineering decision is to define which schema belongs to each page type, then generate it through a shared path.

That doesn't mean every page needs every schema type. Extra markup can be as unhelpful as missing markup when it describes content the visitor cannot see.

i18n with Gatsby. Where SEO usually breaks first

International SEO usually fails at the connection between routing and metadata.

The page renders in another language, but the canonical remains the default language URL. The alternate link points to a route that the site does not generate. Page context contains the locale during page creation, but the Head function receives no locale and falls back to generic metadata.

Gatsby's own research on internationalisation pain points describes problems around routing, page context, canonical tags, and plugin interoperability. Those problems are connected. They're not separate configuration tasks.

Suppose a translated page is created from a content record. The page query may know its language. The route may include a language subpath. The Head function still needs that context to create the correct title, canonical, and hreflang links. If the data isn't passed into the page component or template, every locale can receive the same head output.

Plugin choice can make this harder. A routing plugin may expect one URL structure while an SEO plugin assumes another. An older plugin may no longer match Gatsby's current APIs or your content source. Patrick Stox also points to plugin aging as a practical Gatsby SEO concern, especially when a project depends on plugins that control metadata or sitemap output.

This creates lock in. Replacing the routing plugin may require changing page creation, links, canonicals, hreflang, and sitemap generation at the same time.

Start with the routing model. Decide how a translated page is identified. Pass that locale and its alternate URLs through page context. Make the Head function consume those values directly. Then verify the generated HTML for every supported language, not just the default route.

Abstract stepped shapes with one bridging plane in acid lime.
i18n in Gatsby ties routing, content modeling, and SEO together. If one piece drifts, rankings suffer.

Canonical, hreflang, and routing design for Gatsby marketing sites

Routing is an SEO decision. It determines how users share pages, how analytics groups traffic, and how search engines interpret language versions.

Subpaths keep languages under one host, such as /fr/ or /de/. They're often straightforward to generate in Gatsby because locale can be part of the page path and page context. Subdomains separate languages by host. That can fit an existing regional setup, but it adds host configuration and makes URL generation more dependent on environment settings.

Neither pattern fixes metadata by itself.

A single configuration source should define the site origin, supported locales, route format, and each page's alternate URLs. Canonical generation should use the current page's intended public URL. Hreflang generation should use the same URL map. Sitemap generation should use those canonical URLs rather than reconstructing paths through a separate set of rules.

This removes a common class of disagreement. If the French page canonical says /fr/services/ while the sitemap lists /services/?lang=fr, the systems are publishing different versions of the page. If an alternate points to a route that Gatsby didn't build, the annotation isn't useful.

The main failure modes are easy to describe.

A canonical can always point to the default language, which may cause translated pages to be treated as duplicates. A page can have only a self-referencing canonical and no alternate language relationship, which leaves regional targeting unclear. Hreflang can point to a translated URL that returns a not found response. A regional code can be used for a page that has no regional content difference, or a language code can be omitted from one side of the relationship.

Use a shared URL resolver for links, canonicals, hreflang, and sitemaps. Then test it against actual built routes. Don't assume that a successful Gatsby build proves the language relationships are correct.

For teams already committed to Gatsby, Gatsby development for SEO-focused marketing sites is the point at which this architecture should be designed, before page templates make the wrong assumptions expensive to remove.

Sitemaps, indexing, and debugging Gatsby SEO in production

Sitemap generation often works well for a single-language site and fails after international routes are added.

The generator may include only the original pages. It may include translated URLs before those pages exist. It may use a staging domain. It may list query-string variants while the canonical points to clean paths. It may also include redirects, noindex pages, or routes excluded from the navigation but still present in the build.

Patrick Stox's discussion of Gatsby SEO issues includes sitemap and metadata inconsistencies. His examples are useful because they show how a static build can still publish conflicting indexing signals. A generated file isn't automatically a correct file.

A production check should compare sitemap URLs with canonical URLs. Every sitemap URL should resolve successfully, represent an indexable page, and match the URL the page declares as canonical. Locale pages should appear according to the chosen routing model. If a route is intentionally excluded, its absence should be deliberate.

Structured data needs a source check too. View the published page source and confirm that the JSON-LD is present, complete, and appropriate for that page type. Then inspect the rendered page for visible content that supports the markup. A schema test can't tell you whether the wrong product or language was selected.

Create a release checklist that covers representative page types and locales. Check the home page, a service page, a content detail page, and a translated equivalent. Confirm titles, descriptions, canonicals, alternate links, JSON-LD, status responses, and sitemap inclusion. Repeat the checks after changing routing, content models, SEO plugins, or Gatsby versions.

The checklist should run against production-like output. Development behaviour can hide build-time issues, while browser tools can hide source-level issues.

Deciding if Gatsby is the right fit for your SEO stack

Gatsby can be a good fit for marketing sites where predictable static output, content-driven templates, and a controlled deployment process matter. Its build model makes it possible to inspect the HTML before it reaches production. That's valuable for SEO teams that want clear ownership of metadata and structured data.

The tradeoff appears as the site grows more international or more schema-heavy.

Plugin drift can leave routing or SEO integrations behind current Gatsby behaviour. i18n adds coordination between page creation, content queries, Head output, internal links, canonicals, and sitemaps. Structured data can spread across templates until nobody knows which component owns a schema block. Large content sets can also make build and preview requirements part of the platform decision.

Next.js or another Jamstack option may fit better if the project needs a different rendering model, a more active integration ecosystem, or routing features that match the content plan more directly. That doesn't make Gatsby unsuitable. It means the comparison should happen before design and implementation, not after the first indexing problems appear.

Buyers comparing options should define the SEO requirements first. Specify page types, locale routes, canonical rules, alternate URL rules, schema ownership, sitemap behaviour, and release checks. Then assess which platform can support those requirements without a large collection of exceptions.

If the stack is still undecided, Choosing a Jamstack approach for SEO heavy sites explains the tradeoffs between Gatsby, Next.js, and other options. If Gatsby is already selected but the project has complex language or schema requirements, Technical SEO services for complex builds covers the work of planning that strategy alongside implementation.

Your next step should be an SEO architecture review before the build begins. Map the routes and locales. Assign one source for page metadata and schema. Define how canonical and hreflang URLs, plus sitemap URLs, are generated. Then build a small representative set of pages and inspect their production HTML.

That exercise usually exposes the expensive assumptions early. That's exactly when you want to find them.

Questions people actually ask

Is Gatsby good for SEO out of the box

Gatsby gives you server-rendered pages and a Head API that can output titles, meta descriptions, and JSON-LD directly in the HTML, as described in their SEO guide at https://v3.gatsbyjs.com/docs/how-to/adding-common-features/seo/. That foundation is solid. The problems start when projects pile on multiple SEO and i18n plugins without a clear architecture for canonicals, hreflang, and structured data. Then you can end up with conflicting tags, missing schema, or localized pages that all share the same canonical.

Do I still need structured data if my Gatsby site is fast

Yes. Gatsby’s performance and static output help crawlers reach your content, but they do not tell search engines what the content represents. Gatsby’s own docs show how to embed JSON-LD in the Head component for richer snippets at https://v3.gatsbyjs.com/docs/how-to/adding-common-features/seo/. For a marketing site with products, events, or articles, structured data is how you move from just being indexed to being understood. The risk is adding schema in an ad hoc way per page. At scale that leads to inconsistent or invalid structured data across similar templates.

Why is i18n so tricky for Gatsby SEO

Gatsby’s team has documented that i18n work often runs into SEO and routing pain points at https://www.gatsbyjs.com/blog/2020-07-13-i18n-pain-points/. Locale aware routing, page context, and plugin interoperability all affect how canonicals and hreflang should be generated. If your i18n plugin does not pass the right locale and path data into Head, you can accidentally serve identical tags to every language version. Search engines then struggle to understand which page targets which market, and you may see one locale dominate or others ignored.

Read next

← All posts
The short list

One email when
we publish.

Engineering notes from real builds. No newsletter theatre, no drip sequence, unsubscribe in one click.

We reply to real questions in 1-2 hours. Start a conversation instead →

Follow us on Google See our posts more often in Search and AI Overviews.