How to Fix JavaScript-Dependent Content for Crawlers and AI

Your pages show most of their text only after JavaScript runs. Crawlers that read the raw HTML get a near-empty shell. By the end of this guide you will have measured the gap on each page, moved the main content into the server response through SSR, static generation or build-time pre-rendering, and confirmed that the raw HTML contains it.

By Updated ⏱ 1-3 days for a framework site; 2-4 hours on a CMS where only widgets are affected🎯 Advanced● High impactTechnical
Illustration: JavaScript-dependent content fix guide
TECHNICAL · FIX GUIDE JavaScript-dependent content IMPACTEFFORT TIME1-3 days for a framework site; 2-4 hours on a CMS where only widgets are affected LEVELAdvanced

Why it matters

Googlebot renders JavaScript in a deferred second pass, so content that depends on it can be indexed late, partially or not at all. Most AI crawlers, including GPTBot, ClaudeBot and PerplexityBot, fetch raw HTML and do not execute JavaScript. Text that only appears after rendering is invisible to AI answers and citations.

Social previews, link unfurlers and some accessibility tools also read the initial HTML, so a JS-only page loses visibility in several places at once.

✕Beforehttps://example.com/pricing returns 38words in raw HTML (nav, footer, aloading spinner) but shows 1,120 words✓Afterhttps://example.com/pricing returns1,090 words in raw HTML, so the serverresponse already contains about 97% of

What you need

Access to the site's source code or theme, plus a deploy pipeline
A terminal with curl and python3
Chrome DevTools
Google Search Console access for the property

Step-by-step fix

1

Measure raw vs rendered word count

The audit flags a page when the rendered page has more than 150 words and the raw HTML contains less than 40% of that count. Run both measurements on your key templates: home, category, product or service, article and pricing.

  • Raw: run the command below, which strips scripts, styles and tags from the server response.
  • Rendered: open the page in Chrome, open DevTools > Console and run document.body.innerText.split(/\s+/).filter(Boolean).length.

Divide raw by rendered. Anything under 0.4 needs fixing.

text
curl -sL -A "Mozilla/5.0 (compatible; Googlebot/2.1)" https://example.com/pricing | python3 -c "import sys,re,html; t=sys.stdin.read(); t=re.sub(r'(?is)<(script|style|noscript|template)[^>]*>.*?</\1>',' ',t); t=re.sub(r'(?s)<[^>]+>',' ',t); print(len(html.unescape(t).split()))"
Pro tip: Test one URL per template rather than every page. If one template fails, every page built from it fails.
2

Find out which content is injected by JavaScript

In Chrome, press Cmd/Ctrl+Shift+P, type Disable JavaScript, and reload the page. Whatever disappears is what crawlers miss. The usual causes are:

  • a client-side-rendered app (React, Vue or Angular SPA) that ships an empty <div id="root">
  • data fetched in the browser, such as useEffect, onMounted or fetch after load
  • third-party widgets that inject descriptions, reviews or FAQs
  • tabs or accordions that load their panels on click.

Write down the cause for each template, because the fix differs.

Pro tip: Check the Network tab filtered to Fetch/XHR. Any JSON request that returns your page copy is content that should be on the server.
3

Turn on SSR or static generation in your framework

Pick the rendering mode your framework already supports instead of bolting on a separate service.

  • Next.js: keep pages as Server Components and don't put "use client" at the top of page files.
  • Nuxt: keep ssr: true (the default).
  • Angular: run ng add @angular/ssr.
  • SvelteKit: keep ssr = true in +page.js.
  • Vite + React SPA: move to React Router v7 framework mode, or to Astro, and pre-render.

Use static generation for pages that change rarely and SSR for pages that change per request.

javascript
// react-router.config.ts (React Router v7 framework mode)
import type { Config } from "@react-router/dev/config";

export default {
  ssr: true,
  async prerender() {
    return ["/", "/pricing", "/about", "/features"];
  },
} satisfies Config;
Pro tip: In Nuxt, `routeRules: { '/blog/**': { prerender: true } }` in nuxt.config.ts pre-renders a whole section at build time.
4

Move main-content data fetching to the server

SSR alone doesn't help if the component still fetches its copy in the browser. The server then sends a loading state, which is the most common reason SSR sites still fail this check. Fetch the data in a server component, loader or getServerSideProps/asyncData equivalent so the HTML arrives filled in.

Keep client-side fetching only for personalised or interactive parts such as cart counts or live stock.

javascript
// app/products/[slug]/page.tsx (Next.js App Router, Server Component)
export const revalidate = 3600;

export default async function ProductPage({ params }) {
  const { slug } = await params;
  const product = await fetch(`https://api.example.com/products/${slug}`, {
    next: { revalidate: 3600 },
  }).then((r) => r.json());

  return (
    <main>
      <h1>{product.name}</h1>
      <div dangerouslySetInnerHTML={{ __html: product.descriptionHtml }} />
    </main>
  );
}
Pro tip: Avoid `dynamic(() => import('./Description'), { ssr: false })` for anything that holds body text, because it removes that text from the server HTML.
5

Render tabs, accordions and "read more" in the HTML

Content behind a tab or accordion counts as present if it is in the HTML and only visually hidden. Render every panel on the server and toggle visibility with CSS, the hidden attribute or a native <details> element. Don't fetch a panel's content when it is clicked.

page=2`) behind the button.

html
<details>
  <summary>Shipping and returns</summary>
  <p>Example Co ships within 2 business days. Returns are free for 30 days.</p>
</details>

<div role="tabpanel" id="specs" hidden>
  <p>Weight: 1.2 kg. Dimensions: 30 × 20 × 8 cm.</p>
</div>
6

Pre-render at build time if you cannot adopt SSR

For a legacy SPA you can't refactor yet, generate static HTML snapshots at build time and serve them as the initial document. Tools that do this include Astro, vite-ssg for Vue, prerender in React Router, or ng build with prerender routes in Angular. Avoid serving a different snapshot only to bots (dynamic rendering).

Google treats it as a temporary workaround, and it drifts out of sync with what users see. If you must use it, serve the identical content to everyone.

Pro tip: Regenerate snapshots on every content publish, for example with a CMS webhook that triggers a rebuild, so the pre-rendered text never goes stale.
7

Re-test raw HTML and confirm the result

Deploy, purge the CDN cache, and re-run the curl word count from step 1 on the same URLs. The raw count should now be at least 40% of the rendered count. In practice, aim for 80% or more, since nav and footer are the only things that should differ.

Then inspect a few URLs in Google Search Console and re-run the audit so it can confirm the pass across the whole site.

text
for u in / /pricing /products/widget /blog/getting-started; do
  printf "%s " "$u"
  curl -sL "https://example.com$u" | python3 -c "import sys,re,html; t=sys.stdin.read(); t=re.sub(r'(?is)<(script|style|noscript|template)[^>]*>.*?</\1>',' ',t); t=re.sub(r'(?s)<[^>]+>',' ',t); print(len(html.unescape(t).split()))"
done
Pro tip: Add this loop to CI with a minimum word threshold per URL so a future refactor can't silently move content back to the client.

Platform-specific notes

WordPress

PHP themes output content server-side, so failures usually come from plugins: AJAX-loaded review widgets, "load more" post grids (for example the Elementor Loop Grid with AJAX pagination), or headless setups built on WPGraphQL plus a React SPA. Switch grids to standard pagination, prefer plugins that print reviews in the HTML, and for headless sites use Next.js or Faust.js with SSR or static generation.

Shopify

Liquid themes are server-rendered. Problems come from apps that inject product descriptions, size guides, FAQs or reviews with JavaScript. Look for apps that offer a theme app block with Liquid output, or put the content in product metafields rendered in the template, e.g. {{ product.metafields.custom.faq | metafield_tag }}. Hydrogen storefronts use React Router SSR on Oxygen; keep data in route loaders, not client effects.

Wix

Wix serves server-rendered HTML for standard elements and dataset-bound CMS content. Text that Velo code sets after an async call or user action may only appear client-side. Bind CMS fields through datasets in the Editor instead of setting $w('#text').text in code wherever possible.

Webflow

Native pages and CMS Collection Lists are published as static HTML. Failures typically come from Finsweet CMS Load/Nest attributes, Jetboost, or embeds that pull content from external APIs. Keep primary copy in native CMS fields and use those scripts only for filtering or extra items.

Next.js

The App Router renders Server Components on the server by default. The most common failure is a "use client" page that fetches in useEffect, or a dynamic import with ssr: false. In the Pages Router, use getStaticProps or getServerSideProps instead of client fetching for main content.

Check that it worked

✅ How to verify

  • Run the curl word count again: raw HTML should contain at least 40% (ideally 80%+) of the words shown by document.body.innerText in the browser.
  • In Chrome DevTools, disable JavaScript (Cmd/Ctrl+Shift+P > Disable JavaScript), reload, and confirm headings, body copy and product details are all visible.
  • In Google Search Console, open URL Inspection > Test Live URL > View tested page > HTML and confirm the main text appears in the HTML, not just in the screenshot.
  • Re-run the audit and check that the number of pages flagged for showing less than 40% of their text before JavaScript drops to zero.

⚠️ Common mistakes

  • Enabling SSR but leaving the data fetch in useEffect or onMounted, so the server sends a spinner instead of the content.
  • Serving pre-rendered HTML only to known bot user agents, which creates content drift and cloaking risk when snapshots go stale.
  • Testing only the homepage while product, category or blog templates still render client-side.
  • Forgetting to purge the CDN or page cache after deploying, so the audit keeps fetching the old empty shell.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Doesn't Google render JavaScript anyway?

Yes, but rendering happens in a separate queue after crawling, which can delay indexing. It can also fail on timeouts, blocked resources or errors. Most AI crawlers, such as GPTBot, ClaudeBot and PerplexityBot, don't run JavaScript at all, so content that appears only after rendering is missing from their answers.

Is dynamic rendering still acceptable in 2026?

Google describes dynamic rendering as a workaround, not a recommended long-term solution. Use SSR, static generation or build-time pre-rendering that serves the same HTML to users and bots.

Do I need server-side rendering on every page?

No. Apply it to public, indexable pages with meaningful text, such as product, category, article, landing and pricing pages. Logged-in dashboards, checkout steps and admin screens can stay client-rendered.

Will SSR slow my site down?

Usually it improves Largest Contentful Paint because content arrives in the first response. Keep server time low by caching responses (ISR, revalidate, or CDN caching) and by using static generation for pages that rarely change.