JavaScript SEO: what a crawler sees on a modern site
JavaScript SEO comes down to the first HTML response. Googlebot renders the rest; most AI crawlers do not. How to check your own pages.
Lam Hoang · Systems and engineering

A crawler reads the first HTML response before it runs a single line of your JavaScript. Whatever is in that response, every crawler gets. Whatever appears later, only a crawler that renders gets. That is the whole of JavaScript SEO: making sure the content, links and tags that matter are present in the first HTML, or at least in the rendered HTML Google builds afterward.
Googlebot renders. Most AI crawlers do not. A page that depends on client-side JavaScript can rank in Google and be invisible to the systems that feed AI answers.
What is JavaScript SEO, and what does a crawler actually see?
The first HTML response is the document your server sends. The rendered page is what a browser builds after it runs the scripts. They can differ by the entire body of the page.
Google's JavaScript SEO basics describe the sequence. Googlebot fetches the URL and checks robots.txt. It parses the response for links in href attributes. It then queues pages that return a 200 status for rendering. A headless Chromium runs the JavaScript when resources allow, and Google indexes from the rendered HTML.
The queue can take a few seconds or longer. Pages with a non-200 status, such as a 404, may skip rendering.
Google says the plain-HTML path "works well for classical websites or server-side rendered pages". Some sites use an app shell: the first HTML is a near-empty container, and the content arrives with the script. Google has to render those to see anything.
Take a product page built as an app shell. The first response holds a <div id="root"></div> and a script tag. The title, price and description load from an API after that. Googlebot waits in the render queue and then sees them. A crawler that never renders sees an empty div.
Sort every page element into one of two groups before you test anything:
- In the first HTML: visible to every crawler.
- Added by JavaScript: visible only to crawlers that render.
Main text, internal links, the canonical tag, structured data and the robots meta tag all belong in the first group where you can manage it.
Server, static or client rendering: which one gives a crawler your content?
Server rendering and static rendering put your content in the first HTML. Client rendering does not. The table shows what each crawler type receives from each mode.
| Rendering mode | When the HTML is built | Googlebot receives | Non-rendering crawler receives |
|---|---|---|---|
| Server rendering | On each request | Full content in the first response | Full content |
| Static rendering | At build time | Full content in the first response | Full content |
| Client rendering | In the browser, after scripts run | Full content after the render queue | An empty shell |
Server rendering builds the page on the server for each request. Static rendering builds it once at deploy time and serves the file. Client rendering (the browser builds the page from data it fetches) ships a shell and fills it in.
Most sites need all three. A pricing page can be static. A dashboard behind a login can be client-rendered because no crawler will see it anyway. The page you want found should never be the one that depends on a client-side fetch.
Next.js makes the choice per component, not per page. The framework's rendering philosophy says "the boundary between static and dynamic is at the component level, not the route level." One route can hold a static article body and a dynamic price.
Why dynamic rendering is no longer the answer
Dynamic rendering means serving bots a prerendered copy and users the JavaScript version. Google's page on the workaround does not recommend it. It says "we recommend that you use server-side rendering, static rendering, or hydration as a solution".
Hydration is when the browser attaches JavaScript to HTML the server already built. The content is in the first response and the page still behaves like an app. That is the target state for server-side rendering SEO.
Do ChatGPT, Claude and Perplexity crawlers run JavaScript?
The evidence says the major AI crawlers do not run JavaScript. It comes from a hosting vendor's own logs, so weigh it that way.
Vercel, which hosts Next.js sites and maintains the framework, published crawl data and tests . Its conclusion: "ChatGPT and Claude are explicitly verified: they don't execute JavaScript, so any content that loads via client-side JS is inaccessible to them." Its tests covered the major crawlers, not every bot.
Vercel has a commercial interest in server rendering. The finding is still consistent across what it tested, and it is cheap to check on your own site.
The vendor docs are narrower. OpenAI's crawler overview says "OAI-SearchBot is for search." Anthropic's help center page says "Claude-SearchBot navigates the web to improve search result quality for users." Neither page states whether its bots render JavaScript. Perplexity's documentation was not opened for this article, so it makes no claim about that crawler.
That gap shapes the advice. Do not wait for the vendors to confirm. Put the content in the first HTML, and the question stops mattering.
This is where GEO fits. GEO (generative engine optimization), AEO (answer engine optimization) and AI search optimization name the same discipline: earning citations in AI answers. This article says GEO from here. Content structure gets most of the attention in GEO. Delivery comes first: a crawler that gets an empty shell has nothing to structure.
Which bots to allow in robots.txt
Anthropic separates its bots by purpose. ClaudeBot collects training data, Claude-User fetches pages when a person asks Claude a question, and Claude-SearchBot serves search. OpenAI's page names OAI-SearchBot as its search bot.
Decide on training first, then allow the search bots:
- Training bots (ClaudeBot): your call. Blocking it signals that future material should stay out of training sets.
- Search bots (OAI-SearchBot, Claude-SearchBot): allow them if you want to appear in those products' search results.
- User-triggered bots (Claude-User): allow them if you want Claude to retrieve your pages when someone asks.
Anthropic's page says disabling the search bot "may reduce your site's visibility", so a blanket Disallow: / for all AI bots has a cost.
How does a Next.js site decide what lands in the first HTML?
In the Next.js App Router, a component that runs on the server puts its output in the first HTML. A component marked 'use client' still gets prerendered, but data it fetches in the browser does not.
The Next.js documentation on Server and Client Components says layouts and pages are Server Components by default. Its own example is a post page. The Page component fetches the post on the server and renders the <h1> from post.title. It passes the like count to a LikeButton Client Component for interactivity.
A crawler that never runs JavaScript sees that <h1> and the like count the server passed down. The button's click handler never runs for it, and it does not need to.
The docs also explain why a client component is not empty on first load. On the server, "Client Components and the RSC Payload are used to prerender HTML." The RSC Payload is Next.js's serialized description of the Server Components tree. So 'use client' alone does not hide your content. Browser-side data fetching does.
Compare two versions of the same article page.
Version A, content in the first HTML. The page is a Server Component. It awaits getPost(id) and renders post.title and post.body. View source shows the full article.
Version B, content missing. The page is a Client Component. It starts with empty state and fetches the post inside useEffect, then renders it. View source shows a heading placeholder and a loading spinner. Googlebot renders it eventually. An AI crawler receives the spinner.
The fix is to move the fetch into a Server Component and pass the result down as props. Keep the 'use client' boundary on the parts that need state or event handlers: the like button, the filter dropdown, the cookie banner.
How do you check the rendered HTML yourself?
Compare the raw response against the rendered DOM. If the text you care about is missing from the raw response, only rendering crawlers will see it. The check takes minutes.
Run these in order on one page from each template:
-
View source, not inspect element. In a browser, view-source shows the first HTML response. The inspector shows the DOM after scripts ran. Search the source for a sentence from your main text.
-
Run curl. Fetch the page from a terminal the way a non-rendering crawler does:
curl -s https://example.com/your-page | grep -i "a sentence from the page"No match means the sentence is not in the first HTML.
-
Inspect the rendered HTML Google builds. Google's guide to fixing JavaScript problems says to "Use the Rich Results Test or the URL Inspection Tool to check if the rendered HTML has all content you expect."
-
Check the tags. Confirm the title, canonical, structured data and robots meta tag in the raw HTML and in the rendered version. They should agree.
-
Check the links. Google's basics page says it finds links only in
<a>elements with anhref. A<div onClick>or a#/productsfragment URL is not a link to Googlebot. -
Check the error pages. A single-page app often returns a 200 for a missing page. Google calls these soft 404s and the same fix guide gives two remedies: redirect to a URL where the server answers 404, or add a
noindexrobots tag to error pages.
Treat JavaScript-set robots tags with care. Search Engine Journal's report on Google's guide says "Google warns using JavaScript to change the robots meta tag might not work as expected." A noindex in the first HTML that JavaScript later removes can keep the page out of the index, because Google may skip rendering for a page marked noindex.
Set canonical tags in HTML too. The canonical tags guide covers when a canonical helps and when it hurts.
The pillar article on what technical SEO work covers places this check inside the wider crawl, index and render audit. A full SEO audit runs the same raw-versus-rendered comparison across every template.
What to do this week
- Curl your five highest-traffic templates. Confirm the main text, the internal links and the structured data (JSON-LD) are in the raw response.
- Run URL Inspection in Search Console on one URL per template. Compare the rendered HTML to the curl output.
- Replace every navigation element that is not an
<a href>link, and every#fragment route. - Request a URL that does not exist. Confirm the server returns a real 404 status, not a 200 with an error message.
- Open robots.txt. Decide on training bots, then allow the search bots you want citations from.
- In a Next.js codebase, search for
useEffectcalls that fetch page content. Move each one into a Server Component.
FAQ
Does Google still struggle with JavaScript?
Google renders JavaScript with a headless Chromium, so it can index client-rendered content. The rendering step waits in a queue, and Google's documentation says server-side or pre-rendering is still a good idea because not all bots can run JavaScript. Rendering works. It is not instant, and it does not help other crawlers.
Is dynamic rendering still recommended?
No. Google's dynamic rendering page calls it a workaround and recommends server-side rendering, static rendering or hydration instead. Maintaining a separate bot-only copy adds a second version of every page to keep in sync.
Do AI crawlers see client-rendered content?
Probably not. Vercel's crawl data and tests found that ChatGPT and Claude do not execute JavaScript. That evidence comes from a hosting vendor. OpenAI's and Anthropic's own bot pages describe what each bot is for and do not state whether it renders. Serve the content in the first HTML and you do not depend on the answer.
Sources you can check.
The references behind this article, with their publication and checked dates.
- Understand JavaScript SEO Basics | Google Search CentralGoogle Search Central
Published: undatedChecked:
- Fix Search-Related JavaScript Problems | Google Search CentralGoogle Search Central
Published: undatedChecked:
- Dynamic rendering as a workaround | Google Search CentralGoogle Search Central
Published: undatedChecked:
- Does Anthropic crawl data from the web, and how can site owners block the crawler?Anthropic (Claude Help Center)
Published: Checked:
Where this fits
Technical SEO audit services led by Rob Garner. Get scoped crawl, indexation and schema findings, priorities and a walkthrough. Implementation is separate.
Choose a Free Search Check to identify a useful first priority. See what the Free Search Check includes
More on Technical SEO
All Technical SEO notes

A technical SEO audit checklist for a live site
· 9 min read

An SEO migration checklist for launch week
· 10 min read

Canonical tags: when to use one and when not to
· 9 min read

