JavaScript SEO guide: how Google crawls, renders and indexes JS pages, CSR vs SSR vs static rendering, why AI crawlers often miss JS content, and how to test and fix it.

On this page
In short
JavaScript SEO makes sure that content and links generated by JavaScript can be crawled, rendered and indexed. Google can render JavaScript, but in a separate step that can be delayed and that fails when scripts are blocked or need a click. Many AI crawlers do not execute JavaScript at all. The safest setup is server-side rendering or static generation, real "a href" links, and the important content present in the initial HTML.
Want to go further? Ask
Quick quiz
Who should fix the technical side of your site?
Our advice for you
Check it yourself with free Google tools
Search Console lists the pages Google cannot read, and PageSpeed Insights tests speed. Many small issues are fixed from your website builder settings.
Our advice for you
A web developer
Your problem is in the code or the server: a developer who knows SEO is the right person. Give them the list of errors from Search Console.
Our advice for you
A technical audit tool
Your site has many pages: a crawler reads them all like Google does and gives a full list of errors to fix, page by page.
Our advice for you
An automatic audit, then content
Your site works but brings few visitors: technical issues are rarely the cause. Sorank audits the site, then writes the pages that bring traffic.
Modern frameworks such as React, Vue, Angular or Svelte build pages in the browser. That is great for interactivity and risky for visibility. JavaScript SEO is the set of practices that keeps a JS site readable by search engines and by the AIs. This guide explains how Google processes JavaScript, the rendering options, the common mistakes and how to test your pages.
In three phases: crawling, rendering, indexing. Google Search Central describes the pipeline this way:
The consequence: anything missing from the raw HTML depends on the rendering step succeeding. If a script fails, times out or is blocked by robots.txt, Google indexes what it saw before, which may be an empty shell.
The difference is where the HTML is built: in the browser, on the server for each request, or once at build time.
| Rendering mode | How it works | SEO impact |
|---|---|---|
| Client-side rendering (CSR) | Server sends minimal HTML; JavaScript builds the page in the browser | Highest risk: content depends on rendering, often invisible to AI crawlers |
| Server-side rendering (SSR) | Server builds full HTML for each request, then JavaScript hydrates it | Safe: content and links in the first HTML |
| Static generation (SSG) | HTML generated at build time and served as files | Safest and fastest for content pages |
| Hybrid (SSR or SSG plus islands) | Static or server HTML, JavaScript only for interactive parts | Good balance for most sites |
| Dynamic rendering | Bots receive a pre-rendered version, users the JS app | Workaround that Google no longer recommends |
Frameworks such as Next.js, Nuxt, SvelteKit or Astro make SSR and static generation the default for content pages. For a blog, documentation or product pages, there is rarely a reason to render content only in the browser.
Static site generation (SSG) builds the HTML once, at deploy time. Server-side rendering (SSR) builds it again for every request. Incremental static regeneration (ISR) serves static pages, then rebuilds each one in the background after a set interval. All three put your content in the first HTML response, so none of them hides text from crawlers by default. They differ in how fresh that HTML is and what it costs to serve.
Pick SSG for content that changes rarely. Pick SSR when each request needs current data. Pick ISR when you have thousands of pages that change now and then and a full rebuild takes too long.
With ISR, Google and AI crawlers can read a version of the page up to one interval old. Next.js advises a long interval, such as one hour, and on-demand revalidation for changes that must show at once. On-demand revalidation clears the cache when your data changes, and the next request regenerates the page.
import { revalidatePath } from 'next/cache'
// In the page file: regenerate at most once an hour
export const revalidate = 3600
// In a Server Action, after a post is saved
revalidatePath('/blog') next build and next start instead, then check the x-nextjs-cache header, which shows HIT, STALE, MISS or REVALIDATED.| Page | Mode | Why |
|---|---|---|
| Blog post, docs page, landing page | SSG | Changes rarely, and prebuilt files are the fastest to serve |
| Product page with a changing price or stock count | ISR with on-demand revalidation | Cached for speed, refreshed when the data changes |
| Catalogue with thousands of pages | ISR | Build the popular pages, generate the rest on the first request |
| Page that depends on the visitor or the request | SSR | Each response can differ, so caching it for everyone is wrong |
Whatever you pick, check the raw HTML of each page template. Google's JavaScript SEO basics guide says server-side or pre-rendering is still a great idea, because not all bots can run JavaScript. For framework-specific setup, read our guides to Next.js SEO and Astro SEO. The ISR behavior described above comes from the Next.js documentation on incremental static regeneration.
No, not as a long-term plan. Google calls dynamic rendering a workaround, not a recommended solution, because it adds complexity and resource needs. It can work for a while, as long as bots and users get similar content. Plan to move to server-side or static rendering.
Here is how it works. Your server checks the user agent of each request. Bots that cannot run JavaScript are sent to a rendering service, which returns a static HTML version of the page. Human visitors get the normal JavaScript app. You now run two render paths, and they can drift apart over time.
The main caveat is cloaking. Google does not treat dynamic rendering as cloaking as long as the content is similar. Serving completely different content to users and crawlers can be treated as cloaking (Google Search Central, dynamic rendering documentation).
| Option | What Google gets | Maintenance |
|---|---|---|
| Client-side rendering only | An empty shell in the first response, rendered later by Google | Low to build, hard to debug for SEO |
| Dynamic rendering | Pre-rendered HTML for bots | High, two render paths to keep in sync |
| SSR or static generation | Full HTML for every crawler | Moderate, one render path |
For framework details, read our guides to single-page application SEO and React SEO.
Most issues come from content or links that only exist after an interaction.
Because most AI crawlers read the raw HTML only. Crawler log analyses, such as Vercel's 2024 study of AI crawler traffic, found that the bots of OpenAI and Anthropic fetch JavaScript files but do not execute them. A page whose text appears only after JavaScript runs may look empty to the systems that feed ChatGPT, Claude or Perplexity, even if Google indexes it correctly.
If being cited by the AIs matters to you, put the main answer, headings, tables and links in the server HTML, and check that your robots.txt lets the AI crawlers you want in. Our guide on robots.txt for AI crawlers lists the main bots, and the AI crawlability audit shows what they can read on your pages.
For Google, yes: it indexes the rendered page. For a crawler that reads only the server response, an H1 that is empty at first gives no topic line at all. Put the H1 in the server HTML, with the words that describe the page.
The usual cause is a heading filled from an API call after the page loads. The h1 element exists, but it stays empty until the data arrives.
// Empty in the raw HTML: the text arrives after fetch finishes
function Title() {
const [title, setTitle] = useState('')
useEffect(() => {
fetch('/api/title').then(r => r.json()).then(d => setTitle(d.title))
}, [])
return <h1>{title}</h1>
} The fix is to load the data on the server, so the heading arrives with the first response. In frameworks such as Next.js, fetch the data in the server-rendered page component, not in an effect that runs in the browser.
Headings also matter when no script runs. Screen readers, text-only browsers and some AI crawlers all start from the server HTML. If the H1 is blank there, the page has no visible topic until the script finishes, and a failed script leaves it blank.
Another common problem is an H1 that repeats the site name, a logo or a generic label such as Home. The heading should name the page topic, such as the product, article or category. Keep it close to the title tag, but not identical, so the two signals add information.
Also test a direct load of each URL, not only navigation from the home page. In single-page apps, a route change can update the title without updating the H1 in the first response. A direct load is what a crawler does, so it shows the real result.
Our H1 tag guide covers what Google says about headings, and the heading analyzer shows the H1 to H6 structure of any page.
Google does read it. Google's documentation says it picks up an injected canonical URL when it renders the page. But a canonical that exists only after rendering depends on a step that some crawlers skip, and a canonical that disagrees with the raw HTML gives Google two signals to reconcile.
A canonical is a hint, not a command. Google chooses the canonical from several signals, including redirects, the canonical tag, internal links and sitemaps. Keep them consistent so the choice does not depend on rendering.
<link rel="canonical" href="[absolute URL of this page]"> Tip
Compare the canonical in the raw response with the one in the rendered page. If they differ, fix the server first.
Canonical mistakes are common after a migration. A template may keep the old domain, an http address or a trailing slash that the site no longer uses. Each variant gives Google another URL to choose from, and the wrong one may rank. Compare the canonical on each new page with the URLs in your sitemap, since both should list the same address.
Filtered lists need a decision. A page such as /shoes?color=red with no unique content should point its canonical to the main category. A page with unique content worth indexing can point to itself. A single canonical set on the server keeps that decision in one place, where both search engines and AI crawlers read it in the first response.
Search Console shows the canonical Google selected for a URL in URL Inspection. If it differs from the one you declared, check redirects and internal links first, since they often explain the difference.
To check a page quickly, use the canonical checker, and read the canonical tag guide for the full rules.
Google can use them. Google's documentation says you can set the title and the meta description with JavaScript, and that Google uses the rendered HTML to index the page. The risk is the other crawlers, the ones that read only the server response. Many AI crawlers do not render, so they see whatever the first response contains.
A common failure is a shared shell. A single-page app often ships the same title and description in the raw HTML for every route. Google may correct them after rendering, but a crawler that stops at the first response sees one title for the whole site.
Robots directives need the same care. Google's documentation says that when it finds a noindex tag, it may skip rendering and JavaScript execution, so a noindex added by JavaScript may not work as expected. Put robots tags in the server response.
Check what your server sends before you trust any tool. Run curl on a few URLs from each template and read the title line. If every URL returns the same title, the shell problem is present even if the rendered page looks correct. Tools that show the rendered DOM hide this, so the raw response is the test that matters.
<title>Rendering Checks for JavaScript Sites</title>
<meta name="description" content="How to check titles and meta descriptions in the server HTML before Google renders the page."> Length matters too. Google often rewrites titles that are long, vague or repeated, so write a title that names the page topic once. Keep the meta description a clear summary, written for the reader who sees it in the results. Google may pick a different snippet, but a clear description still gives it the best text to choose from.
For the basics, see our guide to the title tag and our React SEO guide.
Injected links are fine when they are real anchor elements. Google says it can only discover links that are a elements with an href attribute, and it allows JavaScript to inject them into the page. Links built from click handlers, or links that exist only inside the app's router, may never be followed.
<!-- Not discovered: no href, the router does the work -->
<span class="card" onclick="goTo('/pricing')">Pricing</span>
<!-- Discovered: a real link with a crawlable URL -->
<a href="/pricing">Pricing</a> | Link pattern | Found by Google | Fix |
|---|---|---|
| a href in the server HTML | Yes | None |
| a href added by JavaScript after load | Yes, after rendering | Put key links in the server HTML |
| span or div with onclick | No | Use a real a href |
| Hash routes such as /#/pricing | No separate page | Use the History API and clean paths |
Links added after rendering arrive later. Googlebot queues the page for rendering, and Google's documentation says the page can wait in that queue for a few seconds or longer. Key navigation should exist in the first response, so it is found on the first crawl.
Tip
List the links in the raw HTML, then compare the list with the links in the Elements panel. Any path that appears only in the rendered list depends on JavaScript.
curl -s https://www.example.com/ | grep -o "href=\"[^\"]*\"" | sort -u To review internal linking across the site, see our guide to internal linking strategy and the internal link analyzer.
Compare the raw HTML with what Google renders.
Search the raw HTML for a sentence from your main text. If the sentence is missing from the server response but visible in the browser, JavaScript adds it. Google can index it after rendering, but AI crawlers that skip rendering will not see it.
curl -s https://www.example.com/blog/your-post | grep -c "a unique sentence from your article" A result of 0 means the sentence is not in the server HTML. A result of 1 or more means it is. Then open the page in a browser, press Ctrl+F in the Elements panel, and search for the same sentence. If it appears only there, the text is rendered on the client.
| Where the sentence appears | What it means | Action |
|---|---|---|
| In the curl output | Server HTML, read by every crawler | Nothing to fix |
| Only in the Elements panel | Added by JavaScript | Move it to server rendering if it matters |
| In neither | Not on this URL, or shown only after a click | Check the route, the cache and the interaction |
Pick a sentence that appears only once on the page. A page title or a menu label appears in many places and proves little. Also remember that text inside a JSON block in a script tag can match your grep without being visible on the page. Check the visible copy before you trust a match.
Tip
Test a template, not one URL. A single post can pass while every other post in the same template is empty.
For a wider crawl check, read our guide to crawlability.
Six rules cover most cases:
JavaScript and SEO work together when the content does not depend on JavaScript to exist. Render content pages on the server or at build time, keep links real and test what Google and the AIs actually see. Sorank publishes its articles as clean HTML directly in your CMS, with internal links and structured data, on autopilot: see the plans and the 3-day free trial.
The six rules above cover the main risks. For each release, turn them into a short set of tests against the server response, then confirm the result with a rendered check in Search Console.
| Check | How to run it | Pass when |
|---|---|---|
| Main text in the server HTML | curl with a unique sentence | The sentence appears in the output |
| Title and meta description | curl, then grep the title and the meta description tags | One value of each, specific to the page |
| Canonical | curl, then grep the canonical link | One absolute canonical that matches the URL |
| Status code | curl -I | 200 for live pages, 301 for moved pages, 404 or 410 for removed pages |
| Links | grep the href values | Key navigation appears as href values in the HTML |
| robots.txt | Open /robots.txt | No Disallow rule on JavaScript, CSS or API paths |
| Rendered result | URL Inspection in Search Console | Rendered HTML and screenshot match the design |
curl -s -o /dev/null -w "%{http_code}\n" https://www.example.com/blog/your-post
curl -s https://www.example.com/blog/your-post | grep -o "<title>[^<]*</title>" Start with a small set of URLs. Pick one page from each template, such as the home page, a product, an article and a category, and run the checks on those. Template-level checks catch most regressions, and a full site crawl can run later on a schedule.
Store the results so you can compare releases. A simple log with the URL, the status code, the title and the length of the main text shows the change after each deploy. A sudden drop in text length often means a script stopped rendering content on the server, and a log catches that faster than a traffic report.
Do not rely on a passing check alone. A page can return 200 and show the right title while its content loads from a failed API call. Pair the curl checks with a rendered check on a few URLs each week, and watch the page indexing report in Search Console for new errors.
Run these commands in your deployment pipeline, and fail the build when a page returns the wrong status or loses its main text. Read the SEO for developers guide for status codes and tags, and the guide to blocked by robots.txt if a rule catches your bundles.

Yes. Google renders pages with a recent version of Chromium, so it can see content added by JavaScript. Rendering happens after crawling, sometimes with a delay, and fails if scripts are blocked, too slow or depend on user actions. Content present in the initial HTML is always the safest option.
Not automatically, but it adds risk. With client-side rendering the first HTML is almost empty, so search engines must run JavaScript to see the content, and many AI crawlers do not. Server-side rendering or static generation deliver the content directly and avoid these problems.
Most do not today. Analyses of crawler logs, such as the one published by Vercel in 2024, found that the crawlers of OpenAI and Anthropic download JavaScript files without executing them. Content that only appears after JavaScript runs is therefore often invisible to ChatGPT, Claude and similar assistants.
