JavaScript SEO: how frameworks and single page apps get indexed

TL;DR

Difficulty: Advanced

Google runs JavaScript, but it reads your page twice: first the raw HTML your server sends, then, seconds to hours later, the rendered page. Many other crawlers, including most AI crawlers in a 2024 study, never do the second step.

  • Put the content you want found, and the links to it, in the raw HTML. Use JavaScript for interaction.
  • The costly faults are ordinary: click handlers instead of links, pagination behind a button, data endpoints blocked in robots.txt, soft 404s with a 200 status, noindex that JavaScript tries to remove.
  • Server rendering, static generation and hydration are the safe strategies. Dynamic rendering is a workaround Google no longer recommends.
  • Test with view source, JavaScript switched off, URL Inspection and the Rich Results Test.

"My site is built with a JavaScript framework: can Google read it?" Yes, and that is exactly why the problems are hard to spot. Google reads your page twice, once without JavaScript and once with it, and anything that only exists in the second reading is found later, less reliably, or not at all. Here is how that works, what breaks, and how an invented garden furniture shop lost a third of its indexed product pages to a new filter and got them back.

The short answer first

Yes, Google can read a site built with a JavaScript framework. Google Search runs JavaScript in an up to date version of the Chromium browser engine, and it says so in its own documentation1. So the old fear, "Google cannot see JavaScript", is out of date.

The longer answer is the useful one. Google reads your page in two steps, and the second step, the one that runs your JavaScript, happens later, costs Google more and skips some pages entirely. Anything your site only shows after JavaScript has run is therefore found later, found less reliably, and in some cases not found at all. And Google is the most capable reader you have. Other search engines and the crawlers behind AI assistants often run no JavaScript at all.

So the question is never "can Google read JavaScript?". It is "what does my page say before any JavaScript runs, and is that enough?". This chapter shows you how to answer it for your own site, what to fix when the answer is no, and how to judge the developer or the framework that built it. If you have not read the pillar chapter on how search engines crawl, render and index a website, start there: this one goes one level deeper into the rendering step.

The worked example runs through the whole chapter: Barrow Outdoor, an invented online shop for garden and outdoor furniture in Kilkenny, run by Aoife. Barrow added a new product filter written in client side JavaScript, and quietly lost a third of its indexed product pages. By the end you will know exactly why, and how it was fixed.

How Google reads a JavaScript page: crawl, render, index

Google describes three phases for a JavaScript web app: crawling, rendering and indexing1. Here is each one in plain words.

Crawling. Googlebot, Google's crawler, takes a web address (a URL) from its queue. It first checks your robots.txt file. If the address is disallowed, Googlebot does not request it at all, and Google says it "won't render JavaScript from blocked files or on blocked pages"1. If the address is allowed, Googlebot requests it and receives the raw HTML, the text file your server sends back. It reads the status code (200 for fine, 404 for not found and so on), looks for links in that HTML and adds them to the crawl queue.

Rendering. Next, the page goes into a second queue, the render queue. When Google has capacity, a headless Chromium (a browser with no screen) loads the page, runs its JavaScript and produces the rendered HTML, the page as a visitor would see it after everything has loaded. Google's words: the page "may stay on this queue for a few seconds, but it can take longer than that"1. Google then reads the rendered HTML for links again.

Indexing. Google uses the rendered HTML to decide what the page is about and whether to keep it in its index, the giant library it answers searches from.

The industry often calls this "the two waves of indexing": a first look at the raw HTML, a second look after rendering. The phrase comes from Google's own talk at its I/O developer conference in 2018, where it said that "indexing and rendering don't happen at the same time" and that rendering may be deferred2. Google's current documentation no longer uses the word "waves", and the gap has shrunk a lot since Googlebot moved to an evergreen Chromium in May 20193. The idea still holds: there is a first reading without JavaScript, and a later one with it.

Tap or click to open full screen and move around

How long the wait really is

Google does not publish a number for the render queue. The best public measurement I know of is an industry study by Vercel (the company behind the Next.js framework) and MERJ, an SEO and data engineering consultancy. In April 2024 they tracked more than 100,000 Googlebot fetches on nextjs.org and matched over 37,000 of them to the moment the page finished rendering4:

Share of pages renderedTime after the crawl
25%within 4 seconds
50% (the median)within 10 seconds
75%within 26 seconds
90%within about 3 hours
99%within about 18 hours

Two things in that study matter for a shop. Every page with a 200 status was rendered in the end, including pages with heavy JavaScript. And addresses with a query string (the part after a ?, which filters and sorting usually produce) waited longer: their 75th percentile was 31 minutes rather than 26 seconds4. It is one site, built by a framework vendor, on a fast and well linked domain. Treat it as a reasonable picture, not a promise for your site.

Example: an Barrow product page through the pipeline. Googlebot finds https://barrowoutdoor.example/benches/clara-teak-bench in the XML sitemap. robots.txt allows it. The server answers with status 200 and raw HTML that already contains the product name, the description, the price and links to the "Benches" category. Googlebot queues those links immediately. Some seconds or hours later the page is rendered. The JavaScript adds the reviews widget and the "you may also like" carousel. Google indexes the rendered version. Nothing on this page depended on the second step except two extras. That is the healthy case. The trouble starts when the important part, the products themselves, only appears in the second step.

View source and the rendered page are two different documents

Everything in this chapter rests on one distinction, so it is worth getting completely clear.

The raw HTML (developers also say "the source" or "the initial HTML") is what your server sends. You see it with "View page source" in your browser (Ctrl+U on Windows, Option+Cmd+U on a Mac) or with a command line tool such as curl. It is what every crawler gets, whether it runs JavaScript or not.

The rendered HTML (or "the DOM", the Document Object Model, the browser's live model of the page) is what exists after the JavaScript has run. You see it with "Inspect" in your browser's developer tools, and Google shows you its own version in Search Console's URL Inspection tool.

On a classic server rendered site the two are almost the same. On a client side rendered single page app (a site where one HTML page is loaded once and JavaScript builds every view inside it) the raw HTML can be nearly empty: a title, a <div id="root"></div> and a script tag. Google calls this the "app shell model" and notes that Google "needs to execute JavaScript before being able to see the actual page content"1.

Example: Barrow's "Dining sets" category, both ways. Aoife opens https://barrowoutdoor.example/dining-sets and presses Ctrl+U. Since the new filter went live, the source shows the header, the footer, the category title, two sentences of intro text, an empty <div id="product-filter"></div> and a script. No product names, no prices, no links to products. Then he right clicks the product grid and chooses "Inspect". The developer tools show 24 product tiles with names, prices and pictures. A visitor sees a full shop. A crawler that does not run JavaScript sees an empty shelf. Google sees the full shelf only after rendering, and, as the next sections show, only if nothing else gets in the way.

Google finds new pages mainly through links. Its link documentation is blunt: "Generally, Google can only crawl your link if it's an <a> HTML element (also known as anchor element) with an href attribute"5. Most other formats "won't be parsed and extracted"5. A link inserted by JavaScript is fine, as long as it ends up as a proper <a href> in the rendered HTML5.

It is an easy fault to make in a shop, because it is invisible to a visitor. A product tile that navigates when you click it feels like a link. To a crawler, it is just a box.

<!-- Google can follow these -->
<a href="/benches/clara-teak-bench">Clara teak bench</a>
<a href="/benches/clara-teak-bench" onclick="openQuickView(event)">Clara teak bench</a>

<!-- Google may try, but cannot rely on these -->
<a onclick="goTo('/benches/clara-teak-bench')">Clara teak bench</a>
<span href="/benches/clara-teak-bench">Clara teak bench</span>
<a href="javascript:goTo('clara-teak-bench')">Clara teak bench</a>

<!-- Google cannot follow this: there is no link at all -->
<div class="tile" onclick="router.push('/benches/clara-teak-bench')">Clara teak bench</div>

The second line matters: you can keep your JavaScript behaviour (a quick view, an animation, a client side route change) and still give crawlers a real address. The href is for crawlers and for anyone who opens the product in a new tab. The onclick is for the visitor's experience. Google's own examples list exactly this pattern as fine5.

Pagination and "load more" buttons follow the same rule. Google says it "does not interact with your page"6: it does not scroll like a person and it does not click buttons. A "Load more products" button that fetches the next 24 products with JavaScript gives Google the first 24 products and nothing else. Google's guidance for infinite scroll is to give each chunk "its own persistent, unique URL", for example ?page=12, and to link those pages sequentially6.

Example: Barrow's tiles and the "load more" button. The new filter renders each product as <div class="tile" onclick="...">. The rendered HTML of "Dining sets" therefore contains 24 product names but no links to them. Below the grid sits a "Load more" button for the other 64 dining sets. Google renders the page, sees text about 24 sets, and finds no product addresses to crawl. Products still in the XML sitemap can be found from there, but they have lost every internal link from their own category. Google uses links as a signal of importance5, so a product page that nothing links to looks like a page nobody cares about.

Client side routing: use the History API, not fragments

A single page app changes what you see without loading a new page. That is client side routing. It can be done in two ways, and only one of them works for search.

The first way uses fragments: everything after a # in the address, such as https://barrowoutdoor.example/#/dining-sets. Browsers never send the fragment to the server, and Google says it cannot reliably resolve such addresses. Its old AJAX crawling scheme, which once made a special form of fragment crawlable, "has been deprecated since 2015"7.

The second way uses the History API, a browser feature that lets JavaScript change the address bar to a real path, such as /dining-sets, without a full page load. Google's recommendation is clear: "use the History API to implement routing between different views of your web app"1. Every modern framework router does this by default. The fault usually comes from home made widgets.

There is a condition that is easy to miss: the server must also answer that real path. If someone opens /dining-sets?material=teak directly, or Googlebot requests it, the server must return a page with that content, not a blank shell or a 404. A route that only exists inside the browser is not an address, it is a state.

Example: Barrow's filter state. When a visitor ticks "Teak", the filter changes the address to https://barrowoutdoor.example/dining-sets#material=teak. That keeps Google from ever seeing a teak filtered page, which on its own is no loss: whether a filtered page deserves to be found in search is a question for next week's chapter on faceted navigation. But the same fragment trick was used for the pages that matter. Page 2 of the category was #page=2. Google treats everything after the # as the same page, so pages 2, 3 and 4 of every category did not exist for it.

Status codes and soft 404s in single page apps

A status code is the three digit number a server sends before the page itself. Google relies on it to know whether something went wrong: a 404 for a page that does not exist, a 301 for a page that has moved, a 401 for a page behind a login1.

In a client side rendered app the server usually sends the same app shell with a 200 status for every address, and JavaScript decides afterwards what to show. If the product does not exist, the visitor sees "Sorry, this product is no longer available", but the status code said "all fine". Google calls this a soft 404: a page that "returns a user friendly 'not found' message but not a 404 HTTP response code"8. Soft 404s waste crawling, and in Search Console they show up in the page indexing report.

Google documents two fixes for single page apps when the real status code is impractical1:

  • Redirect with JavaScript to an address where the server does answer 404, such as /not-found.
  • Add <meta name="robots" content="noindex"> with JavaScript on error pages.

Both work. Both are second best. The best fix is for the server to know whether the product exists and answer 404 or 410 (gone for good) itself, which is what any server rendered setup does naturally.

The reverse also happens: a real page that looks empty. If the rendered page says "0 products found" because the product data failed to load, Google may classify a perfectly good category as a soft 404.

Example: Barrow's empty categories. In the weeks after the new filter launched, Search Console listed six of Barrow's 14 category pages under "Soft 404". The reason is in the next section but one. The rendered HTML of those six pages said "No products match your filters" with a 200 status. To Google, that is the textbook description of a soft 404.

Titles, canonicals and noindex: keep them in the raw HTML

Google allows JavaScript to set or change the <title> and the meta description1. It can also pick up a canonical tag (the tag that names the preferred address of a page, explained in the chapter on canonical tags and duplicate content) injected with JavaScript, although Google says plainly that it does not recommend doing so, and that conflicting or multiple canonical tags "may lead to unexpected results"1. The same logic applies to hreflang annotations for language editions, covered in the hreflang chapter: they belong in what the server sends.

noindex is the dangerous one. As of this writing, Google's documentation says: "If Google encounters the noindex tag, it skips rendering and JavaScript execution"1. So a page that starts with noindex in its raw HTML and removes it with JavaScript stays out of the index, because the JavaScript that would remove it never runs. The Vercel and MERJ study observed the same thing in practice: pages with noindex in the initial HTML were not rendered, and client side removal of the tag did not work4. It also observed that pages with error codes (3xx other than 304, 4xx, 5xx) were not rendered4.

The rule of thumb: everything Google needs to decide what a page is and whether to index it, meaning the status code, the title, the canonical, the robots directives and the language annotations, comes from the server, in the raw HTML. JavaScript may add to it, never contradict it.

Example: Barrow's product template. Aoife's developer checks the product template and finds that the old platform writes the title, meta description and canonical tag on the server. Good. But the new filter script also writes a canonical tag into category pages, pointing at the address with the current fragment state. On pages where both exist, Google sees two canonical tags with different values. The fix is a one line deletion: the filter stops writing canonical tags, and the server's tag stays the only one.

Lazy loading and infinite scroll done right

Lazy loading means loading images or content only when the visitor is about to see them. It is good for speed, and speed matters (the article on Core Web Vitals and user experience explains why, and a later chapter in this series covers it in practice). Done wrongly, it hides content from Google.

Google's guidance in short6:

  • Load content when it becomes visible in the viewport (the visible part of the screen), using the browser's built in lazy loading for images and iframes (loading="lazy"), the IntersectionObserver API, or a library that does the same. These do not depend on scrolling or clicking, which matters because Google does not interact with the page.
  • Do not lazy load what is visible straight away, such as the main product image. That only makes the page slower for people.
  • For infinite scroll, give each chunk its own address with an absolute page number (?page=12, not ?date=yesterday), link those pages in sequence, and update the address bar with the History API as the visitor scrolls into a new chunk.
  • Test it: in URL Inspection, look for your image addresses in the src attribute of the <img> elements in the rendered HTML.

Example: Barrow's product images. The old category template used a lazy loading script that only swapped in the real image address on a scroll event. In the rendered HTML Google saw src="placeholder.gif" on every tile below the first row. Switching to the browser's own loading="lazy" with the real address in src fixed it, and the first row of four images is no longer lazy loaded at all.

What the renderer does not do

Google's troubleshooting guide lists the differences between its renderer and a visitor's browser7. They explain most of the strange cases.

  • Blocked files are not loaded. If robots.txt disallows the script, the stylesheet or the data address (an API endpoint) a page needs, the renderer works without it1. The chapter on robots.txt, meta robots and XML sitemaps explains the file itself.
  • No memory between pages. Local storage, session storage and cookies are cleared across page loads7. Content that depends on a stored choice (a region picker, a consent state, a "last viewed" list) is rendered as for a first time visitor.
  • Permissions are declined. Location, camera, notifications: Googlebot says no7.
  • Only HTTP. Googlebot does not use WebSockets or WebRTC to fetch content7.
  • Aggressive caching. Google may ignore your caching headers and use an old copy of your JavaScript or CSS. Google recommends content fingerprinting, a file name that changes with its content, such as main.2bb85551.js7.
  • Feature support. Use feature detection and give a fallback where a browser feature might be missing. Google's own example: Googlebot does not support WebGL7.
  • No clicks, no scrolling, no typing. Anything behind an interaction is not seen6.

Example: the real cause of Barrow's empty categories. The new filter loads its products from https://barrowoutdoor.example/api/products?category=dining-sets. Years ago someone added this line to Barrow's robots.txt to keep the old platform's internal endpoints out of Google:

User-agent: *
Disallow: /api/

Visitors' browsers ignore robots.txt, so the shop worked perfectly for people. Google's renderer respects it. It rendered the category, the filter script asked for the product data, the request was blocked, and the page showed "No products match your filters". Hence the six soft 404s. The other eight categories were still indexed with an older rendered copy for a while, then went the same way in the following weeks.

Rendering strategies in plain words

So far, the faults. Now the choices that prevent them. Every website decides where the HTML for a page is produced: on the server, in the visitor's browser, or in advance. The web.dev guide "Rendering on the web" by Addy Osmani and Jason Miller is the standard reference and worth reading in full9. Here is the short version for a business owner, with the depth for developers underneath.

Client side rendering (CSR). The server sends an almost empty page and a bundle of JavaScript. The browser downloads it, runs it, fetches the data and builds the page. Crawlers that run no JavaScript see nothing. Google sees the page after rendering. The guide's warning for developers: JavaScript "tends to grow as an application grows", which can hurt responsiveness9.

Server side rendering (SSR). The server builds the complete HTML for each request. Every crawler sees the full page in the raw HTML. The trade off is server work on every request, which can make the time to the first byte longer9.

Static site generation (SSG), also called static rendering. The HTML for every page is built once, when the site is built, and served as files. Very fast and very robust. The limit: every possible address must be known and generated in advance, which is hard for large or constantly changing sites9.

Incremental static regeneration (ISR). A middle path, named and popularised by Next.js. Pages are generated statically, then regenerated in the background after a set time or on demand. A visitor gets the cached page at once while a fresh one is built10. Nuxt offers similar options under the names ISR and SWR (stale while revalidate)11.

Hydration. The step that combines the two worlds. The server sends complete HTML, so the page is readable at once, then JavaScript in the browser "hydrates" it: attaches the click handlers and state that make it interactive. The Next.js documentation describes hydration as attaching event handlers "to make the static HTML interactive"12. For search this is the good combination: crawlers get the full HTML, visitors get the app. The cost, as web.dev puts it, is "one app for the price of two": the content is sent as HTML and again as data, and the page can look ready before it reacts to a tap9.

Islands. Most of the page is plain server HTML with no JavaScript, and only the interactive parts (a filter, a gallery, a basket) are small "islands" that load their own JavaScript. Astro is built around this idea13.

HTML over the wire. The server renders HTML, and a small library swaps in new HTML fragments from the server instead of building pages from data in the browser. This is the approach of Hotwire, which Ruby on Rails ships as its default since Rails 71415.

StrategyWhere the HTML is madeWhat a crawler without JavaScript seesTypical fit
Client side renderingIn the browserAn empty shellLogged in apps, dashboards, tools behind a login
Server side renderingOn the server, per requestThe full pageShops, content that changes often, personalised pages
Static generationAt build timeThe full pageBrochure sites, documentation, blogs
Incremental regenerationAt build time, refreshed laterThe full page, possibly a few minutes oldLarge catalogues with stable pages
Server rendering plus hydrationServer first, browser afterThe full pageInteractive sites that must also rank
IslandsServer, with small browser partsThe full page except the islandsContent heavy sites with a few widgets
HTML over the wireOn the server, swapped in by fragmentsThe full pageShops and web apps built on a server framework

For developers: where it still goes wrong with SSR

Server rendering does not make you safe by itself. Four faults survive it:

  • Data fetched only on the client. A page component that renders on the server but loads its products in an effect after mounting (in React, a useEffect) sends an empty list in the HTML. The framework is server rendered, the content is not.
  • Hydration mismatches. If the server and the browser produce different markup (dates, random values, things read from window), the framework may throw away the server HTML and render again on the client. Visitors get a flicker. Crawlers that do not run JavaScript keep the server version, which may differ from what Google renders.
  • Client only routes for real pages. A route that only exists in the client router, with no server handler, returns the shell or a 404 when requested directly.
  • Status codes set in the browser. A "not found" component rendered with a 200 status is a soft 404, framework or not. Use the framework's own way to return a 404 from the server.

Example: which strategy suits which Barrow page. Product and category pages carry the shop's search traffic, so they need complete HTML from the server: server rendering, or static regeneration with a short refresh time for prices and stock. The filter can be an island, or a hydrated component, on top of that server HTML. Buying guides such as "How to choose a parasol" barely change and can be static. The account area, order history and basket do not need to rank at all: client side rendering would be fine there. One shop, three strategies, chosen page type by page type.

Frameworks by name, fairly

Every major framework today can produce search friendly HTML. The differences are in the defaults and in how easy it is to step off the safe path by accident. As of this writing:

  • Next.js (React). In the App Router, "layouts and pages are Server Components by default"12. Interactive parts are marked with "use client", are still prerendered to HTML on the first load, then hydrated12. It also supports static generation and ISR10. The common mistake is fetching the main content inside a client component.
  • Nuxt (Vue). The default is "universal rendering": the server returns full HTML, which the browser then hydrates. Client side rendering is an option (ssr: false), and route rules allow hybrid setups with prerendering, ISR and SWR per route11. Nuxt's own docs say web crawlers "can directly index the page's content" in universal mode11.
  • SvelteKit (Svelte). Renders on the server and hydrates by default. Pages can be prerendered at build time, and turning off server rendering "renders an empty 'shell' page instead"16. The docs advise you to server render dynamic pages "for SEO and accessibility"16.
  • Astro. Renders components to HTML and CSS, "stripping out all client side JavaScript automatically", unless you opt a component in as an island with a client: directive13. Very strong for content sites.
  • Remix, now React Router. Remix renders on the server. In May 2024 the Remix team announced that what was planned as Remix v3 would be released as React Router v7, bringing Remix's features into React Router's framework mode17. React Router v7 was released in late 202417. If your developer says "Remix", the current name for new projects is React Router in framework mode.
  • Ruby on Rails with Hotwire. Rails renders HTML on the server by default. Turbo, part of Hotwire, follows a "HTML over the wire" approach in which "all the logic lives on the server, and the browser deals just with the final HTML"14. Turbo Drive speeds up navigation by intercepting clicks on ordinary <a href> links14, so the links stay real links. Solidus, the open source shop framework on Rails, ships a starter storefront that copies its views, controllers and routes into your own app, where they render on the server like any Rails page18.

In fairness to all of them: a single page app built with plain React or Vue and no server rendering is still a valid choice for an app behind a login. And a Rails site can still hide content behind JavaScript, for example a Turbo Frame that loads its content lazily, or a Stimulus controller that fetches product data. The framework sets the default. What your developer does with it decides the result.

Disclosure, since you will want to know where I stand: I build online shops on Ruby on Rails and Solidus and web applications on Rails, and I use Next.js where it is the better fit. I am not neutral on Rails. I am neutral on the principle: the content that should rank has to be in the HTML the server sends.

Example: Barrow's options. Barrow is on an old platform and will relaunch on Solidus later in this series (the relaunch chapter covers how to do that without losing traffic). For now, the fix has to work on the old platform. The old platform renders category templates on the server, so the plan is: let the template render the first page of products as real HTML again, and turn the new filter into an enhancement on top of that HTML instead of a replacement for it.

Dynamic rendering: a workaround Google no longer recommends

Dynamic rendering means detecting crawlers, usually by their user agent (the name a browser or bot sends with each request), and serving them a prerendered HTML version while visitors get the client side app. For some years it was Google's suggested way out for JavaScript heavy sites.

Since August 2022 Google's documentation calls it "a workaround and not a recommended solution, because it creates additional complexities and resource requirements"1920. As of this writing, the page recommends server side rendering, static rendering or hydration instead19. Google adds that dynamic rendering is generally not treated as cloaking (showing crawlers different content from visitors) as long as the content is similar, but that serving completely different content to users and crawlers "can be considered cloaking"19.

Why it is a workaround and not a solution, in practice: you now run two versions of every page, plus a rendering service, plus a list of bots to detect. The two versions drift apart. The bot list goes out of date as new crawlers appear. And every bug has two places to live.

Example: Aoife's quick fix offer. A prerendering service offers Aoife a plug in for €89 a month (an invented price) that would serve Googlebot a rendered snapshot of every category. It would hide the symptom. It would not fix the blocked /api/ path for any other renderer, the links that are not links, or the fragment pagination. And it would leave Aoife paying, every month, to keep two versions of his shop in step. He says no.

Other search engines and AI crawlers

Google is the most capable JavaScript reader you deal with. The others vary, and the safe position is to assume they see your raw HTML and nothing more.

Bing. In October 2019 Bing announced that Bingbot would become "evergreen", rendering pages with Microsoft Edge, which is built on Chromium like Googlebot's renderer21. So Bing can render JavaScript. Google's own documentation adds a general caution: "Other search engines may choose to ignore JavaScript and won't see JavaScript generated content"19, and "not all bots can run JavaScript"1.

AI crawlers. The crawlers that fetch pages for AI assistants are newer, and their makers say little about rendering. The best public evidence is again a Vercel and MERJ study, published in December 2024, which looked at crawler traffic across Vercel's network. It found that "none of the major AI crawlers currently render JavaScript": OpenAI's crawlers, Anthropic's ClaudeBot and PerplexityBot fetched JavaScript files but did not execute them22. Gemini runs on Google's infrastructure, and Applebot renders through a browser based crawler, so those two did render22. This is an industry study of one network at one point in time, not a statement by the vendors, and these crawlers change quickly. It is still a clear enough signal to act on.

Example: what an AI assistant's crawler saw of Barrow. A crawler that runs no JavaScript fetches https://barrowoutdoor.example/dining-sets and gets the raw HTML: a heading, two sentences and an empty <div>. If someone asks an AI assistant "which garden furniture shops in Ireland sell teak dining sets for eight?", Barrow's category page has nothing to offer as an answer, because to that crawler it contains no teak and no dining sets. The product pages, which are still server rendered, do contain the details. That alone is a reason to put the category content back in the raw HTML.

How to test your own site in five checks

You do not need to be a developer for the first three checks. Do them on one product page, one category page and the home page.

1. View source and search it. Open the page, press Ctrl+U (Option+Cmd+U on a Mac), then Ctrl+F. Search for a phrase you can see on the page: a product name, a price, a sentence from the description. If it is there, crawlers that do not run JavaScript see it. If it is not, it only exists after rendering.

2. Count the real links. In the same source view, search for href="/ and look at what comes back. Your product pages, category pages and page 2 of each category should appear as addresses. If the products are visible on screen but their addresses are not in the source, the links only exist after rendering, or not at all.

3. Turn JavaScript off. Google's own suggestion for testing accessibility is to look at the site with JavaScript disabled or in a text only browser such as Lynx1. In Chrome, open the developer tools, press Ctrl+Shift+P, type "Disable JavaScript" and reload. What is left is roughly what a crawler without JavaScript gets.

4. Use URL Inspection in Search Console. Enter the address and run the live test. "View tested page" shows the rendered HTML as Google produced it, a screenshot, the page resources that loaded or failed, and JavaScript console messages23. The screenshot is only available in the live test, not for the indexed version23. Search the rendered HTML for your product names and for href. Under "More info", look for resources marked as blocked by robots.txt. A clean live test is not a promise of indexing: Google notes it does not test for every possible indexing issue23.

5. Use the Rich Results Test. It tests any public address you enter, fetched as Google and not with your own login, and its HTML view "uses the rendered source code"24. Useful for checking a competitor's site, a staging server that is public, or a page you cannot verify.

For developers, the command line version of check 1 and 2, which also shows the status code:

# Status code and headers only
curl -sI https://barrowoutdoor.example/dining-sets

# Does the raw HTML contain the product name, and how many product links?
curl -s https://barrowoutdoor.example/dining-sets | grep -c "Clara teak"
curl -s https://barrowoutdoor.example/dining-sets | grep -o 'href="/dining-sets/[^"]*"' | sort -u | wc -l

# The same request with Googlebot's user agent, to catch servers that treat bots differently
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://barrowoutdoor.example/dining-sets | grep -c "Clara teak"

If the normal and the Googlebot request differ, find out why before anything else. That difference is either dynamic rendering you did not know about or a firewall rule treating bots differently.

Tap or click to open full screen and move around

Example: Aoife runs the five checks. Check 1: the "Dining sets" source contains no product names. Check 2: zero product links, and no link to page 2. Check 3: with JavaScript off, the grid is empty. Check 4: the live test's rendered HTML shows "No products match your filters", and "More info" lists /api/products?category=dining-sets as blocked by robots.txt. Check 5: the Rich Results Test shows the same. Fifteen minutes, and the diagnosis is complete before a developer has opened the code.

The worked example in full: Barrow's filter and the indexing gap

Here is the whole case in order, so you can see how the pieces add up. All of it is invented, including the numbers derived below from the fixed facts about the shop.

The starting point. Barrow Outdoor sells 1,850 products in 14 categories. Organic search brings 38,000 sessions in May, the peak month, and 14,000 in January, with an organic conversion rate of 1.6%, an average order of €470 and a gross margin of 42%. Of roughly 2,600 useful addresses on the site (the 1,850 product pages, the 14 category pages and around 740 guides, help and service pages), the product pages are the ones that sell. Before the new filter, 1,640 of the 1,850 product pages were indexed, and all 14 categories.

The change. To make filtering by material, colour, size, seats and price faster, a developer replaced the server rendered product grid with a client side JavaScript widget. To look at, it was grand. Under the surface it did five things at once:

  1. Product data came from /api/products, which robots.txt blocked for all crawlers.
  2. Product tiles were <div> elements with click handlers, not links.
  3. Pagination became a "Load more" button and, internally, #page=2 fragments.
  4. The filter wrote a second canonical tag that pointed at the fragment state.
  5. Images below the first row used a scroll triggered lazy loading script.

The symptoms. Over the following ten weeks, which ran into the peak season, Search Console showed the picture in the chart below: indexed product pages fell from 1,640 to 1,090. Six categories appeared under "Soft 404". New products added for the summer range sat under "Discovered, currently not indexed", which Google describes as found but "not crawled yet"8, because the only route to them was the XML sitemap. Older products drifted into "Crawled, currently not indexed".

The diagnosis. The five checks above, in fifteen minutes.

The fix. Done on the old platform in about two weeks of development, in this order:

  1. Allow the data endpoint the product grid depends on: remove the Disallow: /api/ line, and if other internal endpoints must stay out, disallow them by name instead.
  2. Render the first 24 products of each category on the server again, each tile an <a href> to the product page.
  3. Replace "Load more" with real paginated addresses (?page=2, ?page=3), linked at the foot of the grid. "Load more" can stay for visitors as long as it loads those same addresses and updates the address bar with the History API.
  4. Let the filter work on top of the server HTML, keeping its state in query parameters through the History API. Which filtered addresses should be indexable is left for the next chapter, on faceted navigation.
  5. Delete the canonical tag written by the filter. The server's tag stays the only one.
  6. Return a real 404 or 410 from the server for discontinued products, instead of a "no longer available" message with a 200 status.
  7. Use loading="lazy" with the real image address in src, and no lazy loading for the first row.
  8. Resubmit the XML sitemap and request indexing for the 14 categories in URL Inspection.

The result. Eight weeks after the fix, 1,760 product pages were indexed, more than before the filter, because page 2, 3 and 4 of every category now linked to products that had never had a category link. All 14 categories were back. The soft 404s were gone.

Of 1,850 product pages, 1,640 were indexed before the client side filter, 1,090 ten weeks after it launched, and 1,760 eight weeks after the fix. Tap or click to open full screen and move around

Index coverage, as a ratio

A simple way to track this is index coverage: the share of the pages you want indexed that actually are. It is a ratio, explained in Foundations: ratios and rates.

C=IUC = \frac{I}{U}

where CC is the index coverage, II is the number of pages of a type that are indexed, and UU is the number of useful pages of that type, the ones you want found.

For Barrow's product pages, with U=1,850U = 1{,}850:

Cbefore=1,6401,850=0.886Cgap=1,0901,850=0.589Cafter=1,7601,850=0.951\begin{aligned} C_{\text{before}} &= \frac{1{,}640}{1{,}850} = 0.886 \\ C_{\text{gap}} &= \frac{1{,}090}{1{,}850} = 0.589 \\ C_{\text{after}} &= \frac{1{,}760}{1{,}850} = 0.951 \end{aligned}

So CC fell from 88.6% to 58.9% and recovered to 95.1%, with CbeforeC_{\text{before}}, CgapC_{\text{gap}} and CafterC_{\text{after}} the coverage before the filter, ten weeks after it and eight weeks after the fix (the arithmetic of a ratio is in Foundations: ratios and rates). Search Console's page indexing report, filtered to a sitemap of product pages only, gives you II for your own shop. A full tour of that report is coming in the chapter on Google Search Console later in this series.

What the gap cost, worked through

Fewer indexed pages is a symptom. The owner's question is what it cost. Here is an estimate for the worst month, May, with every input stated. Two inputs are assumptions, labelled as such.

ΔG=S×p×d×r×v×m\Delta G = S \times p \times d \times r \times v \times m

where ΔG\Delta G is the gross profit lost in the month, SS is the organic sessions the month would normally bring, pp is the share of those sessions that land on product and category pages, dd is the drop in those landing page sessions caused by the gap, rr is the organic conversion rate, vv is the average order value and mm is the gross margin. The method is the one in Foundations: ratios and rates: multiply a volume by a chain of rates.

The inputs: S=38,000S = 38{,}000 (the May figure), r=0.016r = 0.016, v=470v = 470 (€470) and m=0.42m = 0.42 are the shop's fixed facts. p=0.60p = 0.60 and d=0.18d = 0.18 are assumptions for this example: that 60% of organic sessions start on product and category pages, and that the gap cost 18% of them in May.

Step by step:

38,000×0.60×0.18=4,104 sessions lost4,104×0.016=65.664 orders lost65.664×470=30,862 euro of revenue lost30,862×0.42=12,962 euro of gross profit lost\begin{aligned} 38{,}000 \times 0.60 \times 0.18 &= 4{,}104 \text{ sessions lost} \\ 4{,}104 \times 0.016 &= 65.664 \text{ orders lost} \\ 65.664 \times 470 &= 30{,}862 \text{ euro of revenue lost} \\ 30{,}862 \times 0.42 &= 12{,}962 \text{ euro of gross profit lost} \end{aligned}

Line by line: S×p×dS \times p \times d gives the lost sessions, multiplying by rr gives the lost orders, by vv the lost revenue and by mm the lost gross profit, a chain of rates as in Foundations: ratios and rates.

Rounded, that is about €30,860 of revenue and €12,960 of gross profit in a single month. Against that stands a fix of roughly two weeks of development. And the fix keeps paying in the months after, through the products that gained category links for the first time.

The two assumptions are where a real estimate needs your own data: your analytics tell you which landing pages organic visitors arrive on, and comparing the same weeks with the year before gives you a fair figure for the drop.

My view

Use JavaScript for what it is good at: interaction. Filters, galleries, configurators, baskets, live stock counts. Do not use it to deliver the content you want found. The product name, the description, the price, the category's products and the links between them should arrive in the HTML the server sends. That is my view, not a Google rule: Google renders JavaScript and says so. My reason is the asymmetry. Server rendered content is read by every crawler at the first visit. JavaScript content is read by Google later and less reliably, by Bing with its own renderer, and, on the evidence of the AI crawler study, by most AI crawlers not at all. You give up nothing by putting the content in the HTML, and you remove a whole class of faults.

Three practical consequences follow.

  • When you commission a site or a feature, ask one question: "Will the products, text and links be in the raw HTML, before any JavaScript runs?" A good developer answers yes and explains how, whatever the framework. A vague answer is your warning.
  • Every new widget gets the five checks before it goes live, not ten weeks after. Barrow's filter would have failed check 1 on the staging server in a minute.
  • Do not buy a workaround for a design problem. Dynamic rendering and prerendering services treat the symptom and charge monthly for it.

If you are planning a new shop or a rebuild and want this designed in from the start, it is part of how I build online shops on Solidus, Smart Websites and web applications. My prices are published openly.

Conclusion

Google can read JavaScript, but it reads your page twice: once as raw HTML, and later, sometimes hours later, after running your scripts. Anything that only exists in the second reading is found late, depends on everything going right, and is invisible to crawlers that do not render at all. The faults that cost shops their rankings are rarely exotic. They are links that are not links, pagination behind a button, blocked data endpoints, soft 404s with a 200 status, and noindex or canonical tags that JavaScript tries to change. All of them show up in five checks you can run this afternoon.

Choose a rendering strategy page type by page type: server rendered or static for everything that should rank, client side for what sits behind a login. Every major framework can do this. The default and the discipline of whoever builds it decide whether it does. Next week's chapter takes the filter question further: which of a shop's many filter combinations deserve to be found at all, and how to keep the rest from eating Google's attention.

If your shop or site runs on a JavaScript framework and you are not sure what Google really sees, book the free workshop: we run the five checks on your own pages together, and the first two weeks of work are on me.

Sources

  1. 1.

    Google Search Central, Understand the JavaScript SEO basics, documentation last updated 1 April 2025, https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics

  2. 2.

    Martin Splitt, Google Search at I/O 2018, Google Search Central Blog, 7 June 2018, https://developers.google.com/search/blog/2018/06/google-search-at-io-2018

  3. 3.

    Martin Splitt, The new evergreen Googlebot, Google Search Central Blog, 7 May 2019, https://developers.google.com/search/blog/2019/05/the-new-evergreen-googlebot

  4. 4.

    Giacomo Zecchini, Alice Alexandra Moore, Ryan Siddle and Malte Ubl (Vercel and MERJ), How Google handles JavaScript throughout the indexing process, Vercel blog, 31 July 2024, industry study, https://vercel.com/blog/how-google-handles-javascript-throughout-the-indexing-process

  5. 5.

    Google Search Central, Link best practices for Google, documentation, https://developers.google.com/search/docs/crawling-indexing/links-crawlable

  6. 6.

    Google Search Central, Fix lazy loaded content, documentation, https://developers.google.com/search/docs/crawling-indexing/javascript/lazy-loading

  7. 7.

    Google Search Central, Fix Search related JavaScript problems, documentation, https://developers.google.com/search/docs/crawling-indexing/javascript/fix-search-javascript

  8. 8.

    Google Search Console Help, Page indexing report, https://support.google.com/webmasters/answer/7440203

  9. 9.

    Addy Osmani and Jason Miller, Rendering on the web, web.dev, first published 6 February 2019, https://web.dev/articles/rendering-on-the-web

  10. 10.

    Next.js documentation, How to implement Incremental Static Regeneration (ISR), https://nextjs.org/docs/app/guides/incremental-static-regeneration

  11. 11.

    Nuxt documentation (Nuxt 3), Rendering modes, https://nuxt.com/docs/3.x/guide/concepts/rendering

  12. 12.

    Next.js documentation, Server and Client Components, https://nextjs.org/docs/app/getting-started/server-and-client-components

  13. 13.

    Astro documentation, Islands architecture, https://docs.astro.build/en/concepts/islands/

  14. 14.

    Hotwire, Turbo Handbook: Introduction, https://turbo.hotwired.dev/handbook/introduction

  15. 15.

    David Heinemeier Hansson, Rails 7.0: Fulfilling a vision, Ruby on Rails blog, 15 December 2021, https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision

  16. 16.

    SvelteKit documentation, Page options, https://svelte.dev/docs/kit/page-options

  17. 17.

    Brooks Lybrand, Merging Remix and React Router, Remix blog, 15 May 2024, with an update of December 2024, https://remix.run/blog/merging-remix-and-react-router

  18. 18.

    Solidus, solidus_starter_frontend, README, GitHub, https://github.com/solidusio/solidus_starter_frontend

  19. 19.

    Google Search Central, Dynamic rendering as a workaround, documentation last updated 6 March 2025, https://developers.google.com/search/docs/crawling-indexing/javascript/dynamic-rendering

  20. 20.

    Barry Schwartz, Google: dynamic rendering is a workaround and not a long term solution, Search Engine Roundtable, 10 August 2022, https://www.seroundtable.com/google-dynamic-rendering-workaround-33897.html

  21. 21.

    Fabrice Canel, The new evergreen Bingbot simplifying SEO by leveraging Microsoft Edge, Bing Webmaster Blog, 9 October 2019, https://blogs.bing.com/webmaster/october-2019/The-new-evergreen-Bingbot-simplifying-SEO-by-leveraging-Microsoft-Edge

  22. 22.

    Giacomo Zecchini, Alice Alexandra Moore, Malte Ubl and Ryan Siddle (Vercel and MERJ), The rise of the AI crawler, Vercel blog, 17 December 2024, industry study, https://vercel.com/blog/the-rise-of-the-ai-crawler

  23. 23.

    Google Search Console Help, URL Inspection tool, https://support.google.com/webmasters/answer/9012289

  24. 24.

    Google Search Console Help, Rich Results Test, https://support.google.com/webmasters/answer/7445569

Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.