Discussion
  • Indexing
  • JavaScript SEO
  • Technical SEO

On a React storefront where hydration changes the server-rendered title and canonical, which version have you seen Google index, and how did you prove it?

Published 1 reply

Discussion starter: a technical SEO question, posted with an answer from Niraj Raut to open the thread. If you have dealt with this on a site, reply with what you saw, especially where it differs.

Disclosure: Niraj Raut, who posted this answer, runs the SEO consultancy linked at the end of it.

1 reply

  • admin
    Admin
    Original poster

    The short answer is that Google indexes what its renderer ends up with. For the title, the documented expectation is the post-hydration value, as long as rendering runs and your client code produces the same result for Googlebot that it produces in your browser. The canonical is different. Google’s JavaScript documentation tells you not to use JavaScript to change the canonical to a different URL, and it does not say which value wins if you do. A server and client canonical that disagree is an ambiguous signal, not a question with one fixed answer.

    The “how did you prove it” half matters more, because the evidence most people reach for (the title shown in the search results) proves very little. The proof sits in URL Inspection’s indexed HTML, the user-declared canonical field, your server logs, and a token test on disposable URLs.

    What Google documents, and where it stops

    Google’s JavaScript SEO basics page (updated December 2025) describes three phases: crawling, rendering and indexing. Googlebot queues pages that return a 200 status for rendering unless a robots meta tag or header says not to index them, and “Google also uses the rendered HTML to index the page.” On titles the page is permissive: “You can use JavaScript to set or change the meta description as well as the <title> element.”

    On canonicals it is not: “You shouldn’t use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML.” Google gives two acceptable patterns: set the canonical in HTML and keep JavaScript on the same value, or, if you cannot set it in HTML, leave it out of the original HTML and inject it with JavaScript.

    Element What Google documents What it does not document Practical reading
    Title JavaScript may set or change it; rendered HTML is used for indexing How a title that differs between renders is handled over time The hydrated title is the expected indexed value, but only on renders that succeed
    Canonical Do not change it with JavaScript; keep the same value or omit it from the HTML Which value wins when server and rendered canonicals differ The outcome is not predictable, so remove the conflict rather than trying to measure a rule
    Robots noindex A noindex in the original HTML may stop rendering No gap that matters here Removing noindex client-side may not work
    Non-200 status Rendering might be skipped No gap that matters here A client-rendered product on a 404 response may never be seen

    One more distinction before any testing: the title in the search result is a title link, which Google generates from several sources (the title element, visible headings, other prominent text, anchor text). It can differ from both your server and your client title, so it is not evidence of which one was indexed.

    Why “the hydrated version” is not a single version

    Teams often frame this as server version versus client version. In practice there are several possible outcomes per URL, and they can change between crawls.

    Rendering is deferred, and usually succeeds

    The most detailed public dataset is the Vercel and MERJ study (July 2024). Across more than 100,000 Googlebot fetches on nextjs.org in April 2024, excluding errors and non-indexable pages, 100% of HTML pages were fully rendered. The median delay between crawl and render was 10 seconds, but the 90th percentile was about 3 hours and the 99th about 18 hours. That is one well-linked documentation site. A storefront with hundreds of thousands of product URLs, heavier bundles and rate-limited APIs is a different environment, so treat the study as evidence that rendering is routine, not as a guarantee for your templates.

    The client data path can fail for Googlebot

    If the hydrated title or canonical depends on an API call (price, stock, variant, locale), the renderer only gets your intended value if that call succeeds. An endpoint blocked in robots.txt, rate-limited for bot traffic, geo-restricted or slow can leave the server values in place, or worse, push the page into an error state. A “Product not found” title after a failed fetch is a familiar route into the “Soft 404” status in the Page indexing report.

    The framework may send different HTML to different user agents

    Next.js 15.2 introduced streaming metadata, where metadata can arrive after the initial UI. Its htmlLimitedBots setting decides which user agents get blocking metadata in the head instead. The default list includes some Google crawlers (for example Mediapartners-Google, AdsBot-Google and Google-PageRenderer), Bingbot and others. Check the full list for your version before assuming what Googlebot receives. The general lesson applies to any framework: the raw HTML Googlebot gets may not match what you see with a browser user agent.

    Head updates and hydration mismatches are different mechanisms

    A deliberate head update (react-helmet, a useEffect, a router’s head manager) runs after hydration and leaves the client value in the DOM, provided the script runs without error. An accidental mismatch, where server and client compute different values during hydration, is less predictable. React does not guarantee that attribute differences are patched during hydration, and whether a mismatch triggers a client re-render depends on the React version and the component tree. That is why you inspect the rendered DOM rather than reasoning from the code.

    Duplicate tags

    Head managers that append instead of replace can leave two canonical links in the rendered DOM. Google’s long-standing advice is that multiple conflicting canonical declarations can lead it to ignore them, and then internal links, sitemaps and redirects carry the decision.

    The evidence ladder: what each check actually proves

    Evidence How to get it What it proves What it does not prove
    Raw HTML as Googlebot Fetch with the Googlebot smartphone user agent The server output for that user agent Anything about rendering; IP-based logic is not reproduced
    URL Inspection live test Test live URL, then view the rendered HTML, screenshot and JavaScript console How Google’s renderer handles the page today What is in the index
    URL Inspection indexed result View crawled page on the indexed version; search the HTML for the title and canonical The rendered values from the crawl that was indexed Behaviour on other URLs or later crawls
    User-declared canonical Page indexing details in URL Inspection, or the URL Inspection API at scale Which declared canonical Google recorded; the client value here means it read the rendered tag Why Google chose its selected canonical
    Token queries Unique strings in the server and client titles on test URLs Which title text is retrievable from the index How the title link is displayed
    Server logs Googlebot requests for bundles and API endpoints after the HTML fetch That rendering resources were requested That they returned the data the head needed
    SERP title link A normal search Very little Which title was indexed

    Watch for this:

    The live test is not the indexed version. A live test run after a fix shows the renderer’s behaviour now; the indexed result shows what Google stored at the last indexed crawl. Screenshots in the live test are useful for spotting error states, but the canonical question is answered by the indexed HTML and the user-declared canonical field.

    For real templates, sample rather than spot-check. Pick 50 to 100 product, category and variant URLs, record the server value, your browser’s hydrated value, the indexed HTML value and the user-declared canonical. The URL Inspection API returns the canonical fields and last crawl time (not the HTML), so it can extend the canonical check to a few hundred URLs a day.

    A controlled test you can run in two to three weeks

    1. Hypothesis. On this stack, Google indexes the hydrated title and records the hydrated canonical as user-declared.
    2. Test URLs. Three disposable product-style URLs on the production domain and template, using the same bundle and head manager, linked from a regularly crawled page and listed in the sitemap.
    3. Treatment. URL A: server title contains a nonsense token such as “qzmorvak”, client title swaps it for “plentrix”; server canonical is self-referencing, client canonical points to a second test URL that returns 200 and self-canonicalises. URL B: title changes only. URL C (control): server and client agree.
    4. Measurement. Request indexing, then check daily: indexed HTML, user-declared and Google-selected canonical, exact-match searches for each token, and logs for bundle and API fetches.
    5. Failure variant. Repeat URL B with the client API deliberately slowed or blocked for Googlebot to see what the failure state looks like in the index.
    6. Decision rule. If the indexed HTML carries the client values, your rendering path works and the remaining job is to remove the conflict. If server values persist, or the failure variant indexes an error state, move the head to the server before anything else.

    The limitation: a handful of test URLs are not your whole catalogue. The test shows what your stack can produce; the template sample shows what is happening at scale.

    A common storefront version of this bug

    Hypothetical example:

    A React storefront renders https://shop.example/products/linen-shirt as the canonical on the server. After hydration, a head component rebuilds the canonical from window.location.href, so a visit to ?colour=navy&utm_source=newsletter ends up self-canonicalising, parameters included. Every parameter URL Google renders now declares itself canonical. The Page indexing report starts showing “Duplicate, Google chose different canonical than user” and variant URLs appear in the index. The server HTML was right all along; the client overwrote it.

    The fix is not a better guess about which value Google prefers. Build the canonical on the server from route data and an allowlist of parameters that deserve their own URL, and make the client output the identical value, or not touch the tag at all. Titles follow the same rule: if the server sends a generic “Shop” title because product data loads client-side, fix the data loading rather than relying on hydration to correct it.

    What I would change, whichever version is winning today

    • Render the final title and canonical in the server HTML from the same data the client uses.
    • Make the client head manager output identical values, and confirm it replaces tags rather than appending them.
    • If a value genuinely cannot be known on the server, omit it from the server HTML rather than sending a different one, as Google’s documentation allows.
    • Never derive the canonical from the browser location; derive it from the route.
    • Do not personalise title or canonical by locale or currency on the client; use separate URLs with hreflang.
    • Run a JavaScript-rendering crawl that compares raw and rendered titles and canonicals, and alert on any difference in a release check.

    If this were my storefront, I would treat “which version does Google index” as a diagnostic step, not the goal. Answer it once, per template, with indexed HTML and the user-declared canonical, then make the server and client agree so the question stops mattering. A setup where rankings depend on the renderer resolving a conflict in your favour is one bundle regression away from a canonicalisation problem across the catalogue.

    Need help with this on your own site?

    Niraj Raut works with businesses in Nepal, Australia, the UK, Europe and the US on technical SEO, ecommerce SEO, local SEO and AI search.

    See SEO services

Add a reply

Replies are open to approved members. Log in or apply to join.