JavaScript SEO: How to Make Your Website Content Search Engine Friendly
Google can run JavaScript, but that doesn't make every JavaScript site easy to index. Here's how rendering works, what tends to go wrong and how to check your own pages.
By SEO Tool Orbit7 min read

A page built with JavaScript can look perfect in your browser and still give a search engine very little to work with. The content may arrive late, depend on a click, or exist only after a script that failed. Google can run JavaScript, but that's a long way from saying every JavaScript site is easy to index. JavaScript SEO is the work of making sure your content, links and metadata reach search engines reliably, however the site is built.
In short: put the content, title, canonical and links that matter into the HTML your server sends, using server-side or static rendering where you can. Use real <a href> links and normal URLs, return honest status codes, and never rely on JavaScript to remove a noindex. Then compare the raw HTML with the rendered HTML to find out what depends on scripts.
What JavaScript SEO means
Traditional SEO assumes the server sends a complete document. JavaScript SEO deals with the cases where it doesn't: single-page apps, content loaded from an API, and components that only appear after hydration. The questions are technical. Can the content be crawled? Does it render? Does the rendered version get indexed? Good writing that never reaches the index can't help anyone.
How Google processes JavaScript
Google's JavaScript SEO documentation describes three phases:
- Crawling. Googlebot checks robots.txt, fetches the URL and reads the HTML for links. Disallowed URLs are skipped, and Google won't render JavaScript from files it's blocked from fetching.
- Rendering. Pages that return a 200 status are queued for rendering unless a robots meta tag or header says not to index them. A page might wait a few seconds or longer. A headless Chromium then runs its JavaScript.
- Indexing. Google reads the rendered HTML for content and further links, and uses it for indexing.
Two practical points follow. Rendering is an extra step that can fail or be delayed, so content in the original HTML is simply the safer place for anything important. And Google is not the only reader: it notes that not all bots can run JavaScript, and link preview crawlers are a common example.
Server-side rendering, client-side rendering and the options between
| Approach | Where the HTML is built | Effect on SEO | Good fit |
|---|---|---|---|
| Client-side rendering (CSR) | In the browser, by JavaScript | The first HTML is often nearly empty, so everything depends on rendering succeeding | Logged-in dashboards and private tools |
| Server-side rendering (SSR) | On the server, for each request | Content is in the first response | Public pages that change often |
| Static site generation (SSG) | At build time, one file per URL | Content is in the first response and quick to serve | Articles, documentation, marketing pages |
| Hydration | Server HTML first, then scripts attach behaviour | No harm when the server HTML is complete | Interactive pages built on SSR or SSG |
As web.dev's rendering guide puts it, hydration adds state and interactivity to server-rendered HTML. It isn't a separate way of producing content, so a hydrated page is only as complete as the HTML it started with. Heavy hydration costs responsiveness instead; our Core Web Vitals guide covers how to measure and reduce that.
You may also read about dynamic rendering, which serves crawlers a pre-rendered copy while users get the client-side version. Google now calls it a workaround and not a recommended solution, and recommends server-side rendering, static rendering or hydration instead.
Common JavaScript SEO problems
- Links that aren't links. Google discovers links from
<a>elements with anhref. A<div onclick>or a button that changes the route gives it nothing to follow. - Fragment routing. URLs like
/#/productscan't be reliably resolved. Use the History API and ordinary paths. - Content that needs an action. Google doesn't click buttons or trigger user-action scripts, so content fetched only after a click or a "load more" needs a crawlable route as well.
- Soft 404s. A client-side router often answers every path with a 200, including pages that don't exist. Google suggests a JavaScript redirect to a URL that returns a real 404, or adding
noindexto the error view. - Blocked resources. A robots.txt rule covering your scripts or API can leave Google rendering an empty shell.
- Reliance on stored state. Google's troubleshooting page says Local Storage, Session Storage and cookies are cleared across page loads, and permission requests such as camera access are declined. Content mustn't depend on them.
- Unsupported features. Googlebot doesn't support WebSockets or WebRTC, so content delivered that way needs an HTTP fallback.
- Stale files. Google's renderer may ignore caching headers and use old JavaScript or CSS. Put a content hash in filenames, which most bundlers do by default.
How to identify content rendering issues
- Look at the raw HTML. Open the page in the Source Code Viewer, which shows the HTML as the server sent it. Search for a distinctive sentence, your main heading and a few important links.
- Look at the rendered HTML. In Search Console, inspect the URL, choose Test live URL and open View tested page. You'll see the rendered HTML, a screenshot, console messages and loaded resources. Our Search Console guide explains the tool in more detail. Without Search Console access, Google's Rich Results Test shows the rendered HTML as well.
- Compare the two. Text in both is safe. Text only in the rendered version depends on JavaScript and deserves a look. Text in neither isn't visible to Google at all, so check the console errors and blocked resources.
- Check across the site. An SEO Audit reads each page's HTML without running scripts, so anything it reports missing is missing from the first response. That's a quick way to find templates that rely on JavaScript.
If a page still isn't in the index after that, work through the reason Search Console gives, because the cause may have nothing to do with rendering.
Meta tags and canonical URLs in JavaScript applications
- Titles and descriptions can be set or changed with JavaScript, though server output is more dependable.
- Canonical tags belong in the HTML. If JavaScript has to set one, it should match any canonical already there, and the page should end up with exactly one. Our canonical guide covers the wider rules.
- Noindex is the one to be careful with. When Google sees it, it may skip rendering, so JavaScript can't reliably remove it. If you want a page indexed, leave
noindexout of the original HTML. - Open Graph tags need to be in the initial response, because many preview crawlers don't execute scripts.
In the Next.js App Router, per-page metadata is generated on the server:
export async function generateMetadata({ params }) {
const { slug } = await params;
const product = await getProduct(slug);
return {
title: product.name,
description: product.summary,
alternates: { canonical: `https://example.com/products/${slug}` },
};
}
A practical checklist for Next.js and React
- Keep public content in Server Components, and put
'use client'only on the interactive parts. - Don't load a page's main content in
useEffect; it won't be in the first response. - Export
metadataorgenerateMetadatafor every public route. - Use
next/linkor plain anchors, which output a real<a href>. - Know how streaming affects status codes. Once a response has started streaming it stays a 200, so
notFound()then relies on an injectednoindex. For a true 404, check that the record exists before streaming begins. - Don't be alarmed if a raw fetch shows metadata late in the document. Next.js can stream it for crawlers that run JavaScript, and keeps it in the
<head>for bots it identifies as HTML-only, a list you can change withhtmlLimitedBots. - For a client-only React app, use a router based on the History API and pre-render your public pages.
- Generate the sitemap from the same data as the routes, so the two can't drift apart.
- Test a real production build, since development servers behave differently.
Mistakes developers should avoid
- Testing only in your own logged-in browser, where cookies and cached data hide problems.
- Showing crawlers substantially different content from users, which can count as cloaking.
- Sending a paywalled article's full text and hiding it with JavaScript. Serve it only once access is confirmed.
- Assuming that because one template renders, all of them do. Check each page type.
Frequently asked questions
Can Google index JavaScript content?
Yes, Google renders pages with a headless browser and indexes the result. It isn't guaranteed for every page, and rendering is an added step that can fail or be delayed.
Is server-side rendering required for SEO?
No, but Google describes server-side or pre-rendering as still a great idea, because it makes sites faster for users and crawlers and not all bots can run JavaScript.
Does hydration hurt SEO?
Not on its own, because the content is already in the server HTML. It can affect responsiveness if the page ships a lot of JavaScript.
Do other search engines render JavaScript?
Capabilities vary and aren't all documented, so the dependable approach is to put important content in the initial HTML.
Next step
Pick your most important page template and open one URL in the Source Code Viewer. If the main heading, body text and links are there, that template is in good shape. If they aren't, compare it with the rendered HTML in Search Console and decide what should move to the server.
- #JavaScript SEO
- #Technical SEO
- #Crawling & Indexing
Related reading

Technical SEO
Why Google Isn't Indexing Your Pages (and How to Fix It)
A page you published isn't in Google. Search Console usually tells you why — here's how to read each reason in the Page indexing report and fix what you can control.
8 min read

Technical SEO
How to Use Canonical Tags to Prevent Duplicate URL Problems
The same page often lives at several addresses. Canonical tags tell search engines which one to index — when they agree with your other signals.
5 min read

Website Optimization
How to Optimize Core Web Vitals and Website Performance
Core Web Vitals measure loading, responsiveness and visual stability. Here's what each one means, what usually causes problems, and how to fix and measure them honestly.
5 min read

Technical SEO
How to Perform a Technical SEO Audit Step by Step
A technical audit answers one question: can search engines reach, understand and index your important pages? Here is the order to check things in, and what to fix first.
6 min read