The short answer
- Google crawls a page, queues it for rendering in a headless Chromium browser, and indexes what the rendered page contains.
- Server-side rendering or static generation puts content and links in the HTML the server sends, so crawlers can read it without running JavaScript.
- Each page needs its own URL using the History API, real links with an href, and its own title, description and canonical tag.
A JavaScript website can rank well in Google, as long as search engines can get the content, links and metadata of every page. Google renders JavaScript in a separate step after crawling, while many AI crawlers read only the HTML the server sends and never run scripts. A single-page app, or SPA, is a site that loads one HTML shell and then uses JavaScript to draw each page in the browser, which is why it needs extra care.
How Google processes JavaScript
Google’s documentation describes three stages for JavaScript pages: crawling, rendering and indexing.
- Crawling. Googlebot checks robots.txt, fetches the URL and reads the HTML the server returns. It collects any links it finds in that HTML.
- Rendering. The page joins a queue. When resources allow, a headless version of Chromium loads it, runs the JavaScript and produces the finished page.
- Indexing. Google reads the rendered page, including content and links added by JavaScript, and uses it for indexing.
Google queues pages that return a 200 status for rendering unless they tell it not to index them. The risks are in timing and completeness. Rendering happens after crawling, scripts that fail or time out leave content missing, and anything that appears only after a click or a scroll may never be seen, because Googlebot doesn’t interact with a page the way a person does.
There is also one trap that catches many teams. If the HTML the server sends contains a noindex robots tag, Google may skip rendering altogether. JavaScript that removes the tag later never gets the chance to run.
Rendering options compared
How your pages are built decides what a crawler receives on its first request. This is the most important SEO decision on a JavaScript site.
| Approach | What the crawler first receives | Good for | Trade-offs |
|---|---|---|---|
| Client-side rendering (CSR) | An almost empty HTML shell and a script | Logged-in apps and dashboards | Content depends on rendering; weak for search and AI crawlers |
| Server-side rendering (SSR) | Full HTML built on the server for each request | Pages that change often or vary by visitor | Needs a running server; pages are only as fast as the server |
| Static generation (SSG) | Full HTML built in advance at deploy time | Marketing pages, blogs, documentation | Content changes need a rebuild or incremental regeneration |
| Dynamic rendering | Pre-rendered HTML for bots, the app for people | A stopgap for older single-page apps | Google describes it as a workaround and doesn’t recommend it long term |
Most modern frameworks, including Next.js, Nuxt, SvelteKit and Astro, can mix these approaches page by page. A common pattern is static generation for public marketing pages and client-side rendering behind the login, where search engines don’t need to go. Static pages also tend to load quickly, which helps with Core Web Vitals.
Hash routing and why each page needs a real URL
Older single-page apps often used addresses like example.com/#/pricing. Everything after the # is a fragment. Browsers don’t send fragments to the server, and Google generally treats addresses that differ only by fragment as the same URL. A site built this way can look to Google like a single page.
The fix is the History API, which lets an app change the address bar to a normal path such as example.com/pricing without reloading the page. The server must also respond correctly when someone requests that path directly, returning the right content with a 200 status, or a 404 status when the page doesn’t exist.
That last point catches many SPAs. If the server returns the app shell with a 200 status for every path, the address of a deleted product looks like a live page. Google calls these soft 404s. Return a real 404 status from the server, or have the error view redirect to a URL that does, or add a noindex robots tag to it.
Links that crawlers can follow
Google follows links only when they are a elements with an href attribute holding a URL it can resolve. A button or a div with a click handler that changes the page works for people and is invisible to crawlers. The link components in most frameworks render a proper a element with an href, so use them instead of navigating inside a click handler.
Links are also how search engines judge how pages relate and which matter most, which we cover in internal linking for SEO. An XML sitemap helps discovery, but it doesn’t replace links between pages.
Metadata for every page
Each URL needs its own title, meta description and canonical tag, and pages meant to be shared need their own Open Graph tags. In client-rendered apps these are often set once in the shell and never changed, so every page claims to be the home page.
- Set the title and meta description per route, ideally in the server-rendered HTML.
- Point each canonical tag at the page’s own clean URL.
- Put any noindex directive in the server response, never in JavaScript alone.
- Render structured data with the page, so it is present in the first HTML.
- Don’t block JavaScript or CSS files in robots.txt, because Google needs them to render the page.
- Use real image elements with alt text for images that matter, and avoid loading key content only on scroll.
Testing what Google and AI crawlers see
The URL Inspection tool in Google Search Console shows how Google sees a page. Run a live test, then view the tested page to see the rendered HTML, a screenshot and any resources that failed to load. If your content or links are missing from the rendered HTML, Google is missing them too. Google’s Rich Results Test also shows rendered HTML, and works for public URLs on sites you haven’t verified.
For AI crawlers, check the raw HTML. Many AI crawlers fetch a page and read the HTML the server returns without running JavaScript, so a client-rendered page can look empty to them. Use your browser’s view source, or fetch the page with a command-line tool such as curl, and confirm the main text and links are there. Whether you let those crawlers in at all is a separate decision, covered in AI crawlers and robots.txt.
Search Console’s Page indexing report is the longer-term check. Watch for public pages listed as soft 404s, as duplicates without a canonical, or as crawled but not indexed, and inspect a few of each to find the pattern.
Questions people ask
Can Google index a React or Vue website?
Yes. Google renders JavaScript and can index content that React, Vue and other frameworks add to the page. Indexing is more dependable when the content is already in the server’s HTML through server-side rendering or static generation, because it doesn’t then rely on rendering working perfectly.
Is client-side rendering bad for SEO?
It is riskier for public pages that need to rank. Content and links depend on the rendering step, metadata mistakes are common, and many AI crawlers won’t see the content at all. It is fine for logged-in areas that search engines don’t need to index.
Do AI crawlers run JavaScript?
Many don’t. Several AI crawlers read only the HTML the server sends, so content drawn by JavaScript can be invisible to them. Putting your main content in server-rendered or static HTML is the safest way to be read and quoted.
Does Google index URLs with a hash?
Google generally ignores the part of a URL after the hash, so pages that differ only by fragment are treated as one URL. Use normal paths through the History API for any page that should appear in search on its own.