Guide

How to fix JavaScript-rendered content for AI crawlers

Shaheer Malik
Shaheer Malik
Founder, WebValet
4 min readUpdated

The short answer

Make sure your important text is in the HTML your server sends, not added later by JavaScript. Test by fetching the raw page with curl or viewing the source. If key content is missing, switch those pages to server-side rendering, static generation or prerendering. Then retest the raw HTML and Google's rendered view.

  • If text is missing from the raw HTML, some AI crawlers will likely miss it.
  • Googlebot runs JavaScript, but many AI crawlers are reported not to.
  • Server-side rendering, static generation and prerendering all put content in the first response.
  • Structured data and internal links need to be in the server HTML too.

Why can JavaScript hide content from AI crawlers?

Some websites send a nearly empty HTML page and build the content in the browser. This is called client-side rendering. A person with a modern browser sees the full page.

A crawler is an automated program that fetches pages. Googlebot runs JavaScript, although rendering can happen later than the first fetch. Many AI crawlers are reported to read only the raw HTML.

Crawler behavior changes, so check each platform's documentation for the current position. The safe assumption is simple. If your key text is not in the raw HTML, some crawlers will not see it.

How to find and fix JavaScript-rendered content, step by step

Start with a few important pages, then roll the fix out across the site.

  1. 1

    Pick your most important pages

    Choose your homepage, main service or product pages, pricing, About page and best-performing articles. These are the pages buyers and AI answers rely on most.

  2. 2

    Fetch the raw HTML

    Use curl, or your browser's 'View page source', not the element inspector. Search the result for a sentence you know is on the page.

  3. 3

    Compare with Google's rendered view

    In Search Console, use URL Inspection, then 'Test live URL' and 'View tested page'. This shows what Googlebot sees after running JavaScript.

  4. 4

    List what is missing

    Note any headings, body text, prices, links or structured data that appear only after rendering. Missing navigation links matter too, because crawlers follow them.

  5. 5

    Choose a rendering fix

    Move key pages to server-side rendering, static generation or prerendering. Most modern frameworks support at least one of these. Your developer can advise which fits your setup.

  6. 6

    Move schema and meta tags server-side

    Structured data added by a tag manager may only exist after scripts run. Put JSON-LD, titles and meta descriptions in the server HTML instead.

  7. 7

    Retest every changed template

    Repeat the raw HTML test on each page type after the change. Check again after every major site release.

What does a quick raw HTML test look like?

Run these commands in a terminal. Replace the address and the phrase with a real page and a sentence from it.

If grep prints nothing, the phrase is not in the raw HTML. Sending a crawler's name as the user agent shows what your server returns to that name. It does not prove what the real crawler receives.

# Raw HTML, as a crawler that does not run JavaScript sees it
curl -s https://www.example.com/services/ | grep -i "emergency plumbing"

# Same test, sending a crawler name as the user agent
curl -s -A "GPTBot" https://www.example.com/services/ | grep -i "emergency plumbing"

# Count the visible words in the raw HTML (rough check)
curl -s https://www.example.com/services/ | sed 's/<[^>]*>//g' | wc -w

Which rendering approach should you use?

The table compares the common options. The right choice depends on how often your content changes and what your framework supports.

ApproachWhat it meansGood for
Client-side renderingThe browser builds the page with JavaScriptLogged-in apps and dashboards, not public content
Server-side renderingThe server builds full HTML for each requestPages that change often, such as stock or prices
Static generationFull HTML is built ahead of timeMarketing pages, guides and service pages
PrerenderingA service saves rendered HTML and serves it to crawlersOlder sites that cannot change framework soon
Dynamic renderingBots get rendered HTML, people get the JavaScript appA stopgap only; Google calls it a workaround

How to check it worked

Run the raw HTML test again on every page you changed. Your key sentences, headings and links should now appear without JavaScript.

Use URL Inspection in Search Console to confirm Google still sees the full page. Then watch the Pages report for indexing changes over the next few weeks.

Finally, check that your structured data validates in the Rich Results Test. Test the live URL, not a pasted code snippet.

Common mistakes with JavaScript-rendered sites

These issues often survive a rendering fix, so check for them separately.

  • Loading tab or accordion content only when someone clicks it.
  • Using buttons with click handlers instead of real links with an href.
  • Blocking JavaScript or CSS files in robots.txt, which breaks Google's rendering.
  • Injecting structured data only through a tag manager.
  • Loading articles through infinite scroll with no paginated URLs.
  • Letting bot protection show crawlers a challenge page instead of content.

Questions people ask

Does Google have trouble with JavaScript?

Googlebot can render JavaScript, and many JavaScript sites rank well. Rendering can be delayed, though, and errors can hide content. Server HTML removes that risk for Google and other crawlers alike.

Do AI crawlers run JavaScript?

Many are reported to read only the raw HTML, at the time of writing. Platforms rarely document this in detail, and it can change. Treat raw HTML as the version every crawler can read.

Is dynamic rendering still a good idea?

Google describes dynamic rendering as a workaround, not a long-term solution. It adds a second version of your site to maintain. Server-side rendering or static generation is usually the better fix.

Will this fix improve my rankings or AI visibility?

It removes a barrier, but it does not guarantee results. Crawlers still need a reason to trust and cite your pages. Content quality and outside sources matter just as much.

Put it to work

Check it, track it, or have it done

No trial and no lock-in. Start free, then choose.

  1. 01 · Start here

    Free check

    $0no signup

    See how ready your site is for Google and AI crawlers. About 20 seconds.

    Run a free check
  2. 02 · Track it weekly

    Pro

    $19/month · or $190/year

    25 buyer prompts on ChatGPT, Gemini and Perplexity, against 3 competitors. No trial, cancel anytime.

    Get Pro
  3. 03 · Done for you

    Hire Team Shaheer Malik

    $249/month · Pro included

    Shaheer's team does your SEO and GEO every month: pages, citations, listings and fixes.

    Schedule a call