Web Development

JavaScript SEO for React and Next.js: What Google Sees

JavaScript SEO for React and Next.js: What Google Sees: MeraSEO article cover
Key takeaways
  • Google can run JavaScript, but it does so in a second step after fetching the HTML. Content, links and metadata that exist in the first HTML response are the safest.
  • Server-side rendering and static generation put the content in the initial HTML. Client-side rendering leaves it to the browser, which adds risk.
  • Five common failures: onClick navigation instead of real links, identical titles on every route, content hidden behind scroll or clicks, 200 responses for missing routes, and blocked script or style files.
  • Use URL Inspection to compare what Google rendered with what you see, then run the pass/fail checklist below.

Your developers built the site in React, Vue or Next.js and it looks great in a browser. Then Search Console shows pages without titles, important sections missing from the rendered HTML in URL Inspection, or routes that never get indexed. The site works for users and fails for crawlers.

This post is for startups, agencies and in-house teams who already have a JavaScript-driven site and want to audit it. If you are still choosing a stack, start with our comparison of tech stacks for a business website instead.

How Google processes a JavaScript page

In simple terms, Googlebot works in two stages. First it fetches the page’s HTML, notes the links it finds and queues the page. Later it renders the page in a headless version of Chrome, runs the scripts and reads the resulting content. Rendering takes extra resources, so it can lag behind the first fetch.

That is why where the content comes from matters. Google’s own JavaScript SEO basics describe this process and its limits.

Client-side, server-side and static rendering

ApproachWhat the first HTML containsSEO risk
Client-side rendering (CSR)An almost empty shell plus a script bundle. The browser builds the page.Highest. Depends entirely on rendering. Crawlers that do not run JavaScript see little or nothing.
Server-side rendering (SSR)Full content, built on the server for each request.Low. Watch server response time and caching.
Static generation (SSG)Full content, built ahead of time as files.Lowest for content that changes rarely. Needs a rebuild when content changes.

For marketing pages, service pages and blog posts, SSR or SSG is usually the safer default. Reserve client-side rendering for logged-in dashboards and interactive tools that you do not need indexed. This is also why a headless build, such as WordPress as the content source with a Next.js front end, needs the rendering mode chosen deliberately. See our headless WordPress development page for how we approach it.

You may also read about dynamic rendering, where bots get a pre-rendered copy and users get the JavaScript app. Google describes it as a workaround rather than a recommended solution, so treat it as a stopgap while you move key pages to SSR or SSG.

See what Google actually saw

  1. Open Search Console and paste the URL into URL Inspection.
  2. Choose Test live URL, then View tested page.
  3. Check the HTML tab: this is the rendered DOM. Search it for your main heading, a paragraph of body text, your internal links and the title tag.
  4. Check the Screenshot tab for large blank areas, and the More info tab for blocked resources or console errors.
  5. Compare with a plain “view source” in your browser. If the content is in the rendered HTML but missing from view source, you depend on rendering.

A second quick test: disable JavaScript in your browser’s developer tools and reload. Whatever remains is roughly what a non-rendering crawler gets.

The failures that cost visibility

1. Links that are not links

Googlebot follows <a href=”…”> elements. A card or button that navigates through an onClick handler, or an anchor with only a hash, gives it nothing to follow. Use real anchors with real URLs, and let the router intercept clicks for users (the Next.js Link component, for example, renders a normal anchor). Route with real paths through the History API, not #/ fragments, which Google does not reliably treat as separate pages. It is the same family of problem as dead buttons on a WordPress site, which we cover in finding and fixing broken links and dead buttons.

2. The same title and description on every route

Single-page apps often update the page content but not the document title or meta description, so every route shares the homepage’s. Set a unique title, meta description and canonical per route, in the server-rendered head. Our guide to title tags and meta descriptions covers how to write them.

3. Content that appears only after a scroll or a click

Google does not click tabs, accept cookie banners or type into filters. Text that loads only after such an interaction may never be seen. Googlebot also does not scroll like a person, so content fetched by a scroll event listener, or an infinite feed with no paginated URLs, can be missed. Lazy loading that uses native loading=”lazy” or IntersectionObserver is the safer pattern. Content that needs a click should already be in the HTML, then hidden with CSS.

4. Soft 404s from a catch-all route

Many SPAs return a 200 status for every URL and draw a “not found” screen in the browser. Crawlers read that as a real page. Make the server return an actual 404 status for unknown routes, and give the same treatment to deleted products or posts. If the app is purely client-side and the host cannot do that, Google’s documented fallbacks are to redirect with JavaScript to a URL that does return 404, or to add a noindex robots meta tag to the error view.

5. Blocked scripts and styles

If robots.txt blocks the JavaScript or CSS files, Google renders a broken page. Allow crawling of the folders that hold your bundles, and watch for scripts hosted on a third-party domain that fails or times out.

Do other crawlers run JavaScript?

Do not assume so. Documentation varies by crawler, and many AI-related crawlers are reported not to execute scripts, so a client-side-only page can look empty to them. The cautious approach is to ensure your key content, links and structured data are present in the initial HTML. To check which bots visit you and what they request, see our guide to AI crawlers, server logs and robots.txt.

A pass/fail audit checklist

CheckHow to testPass if
Main content in the first HTMLView source, search for a body sentenceThe sentence is present
Unique title and meta per routeCrawl the site, export titlesNo duplicates across routes
Crawlable internal linksInspect nav and cards in rendered HTMLEach is an anchor with a real href
Real 404 statusRequest a made-up URL and read the response codeReturns 404, not 200
Scripts and styles crawlableURL Inspection, More info, page resourcesNo blocked resources
Content not behind interactionCompare rendered HTML with the visible pageTab and accordion text is in the DOM
Structured data presentRich Results Test on the URLDetected without errors
Speed after renderingPageSpeed Insights, mobileLCP at or below 2.5 s

Heavy JavaScript bundles also hurt Core Web Vitals, which is a separate reason to render on the server. The web.dev guide to Core Web Vitals explains the thresholds, and our technical SEO service covers rendering and speed audits together.

Metadata and structured data in a JavaScript app

Titles, canonical tags and structured data should be rendered on the server along with the content. If a script injects them after load, Google may still pick them up, but you are adding a dependency for no benefit. In the Next.js App Router this means exporting metadata or generateMetadata from the page or layout (Pages Router sites use next/head) rather than setting the title from a client component after load. Validate JSON-LD with the Rich Results Test, and make sure each route outputs only the markup that matches its own content, not a copy of the homepage’s.

A realistic fix order

  1. Fix the status codes and the per-route titles, since they are quick and visible.
  2. Replace onClick navigation with anchors.
  3. Move the pages you want to rank to SSR or SSG; leave app screens as they are.
  4. Re-test with URL Inspection, then monitor the Page indexing report for weeks, not days.

Frequently asked questions

Can Google index a React single-page app?

Yes, Google renders JavaScript and can index React pages. But it does so after the first fetch, and problems such as missing links, duplicate titles or blocked scripts can keep pages out. Server-side rendering or static generation makes the content available in the initial HTML and reduces the risk.

How do I check how Google sees my JavaScript page?

Use the URL Inspection tool in Search Console, run a live test, and open View tested page. Compare the rendered HTML and screenshot against what you see in the browser. Search the HTML for your headline, body text and links.

Is Next.js good for SEO?

Next.js supports server rendering and static generation, which suit SEO well, but it is not automatic. You still need per-page titles, real links, correct status codes and fast pages. A badly configured Next.js site can still have the same problems as any client-side app.

Do AI crawlers read JavaScript content?

Do not rely on it. Support differs between crawlers and many do not execute scripts. Put your key content, links and structured data in the initial HTML, then check your server logs to see which bots actually visit and what they receive.

Building or auditing a headless site?

We build headless WordPress and Next.js sites with rendering, metadata and crawlability planned from the start, and we audit existing JavaScript builds.

Talk about headless WordPress →

Related Post

Call Now Button