Himanshu SharmaSoftware engineer
Let’s talk

SEO Basics · Lesson 22 of 32

JavaScript and SEO: making rendered content findable

How Google crawls, renders and indexes JavaScript pages, the rendering options (server, static, client), and common traps with links and status codes.

12 minTechnical SEOUpdated 14 November 2026

Awaiting technical review. This lesson is readable but not yet listed in search engines.

By the end of this lessonExplain how Google processes JavaScript pages and choose a rendering approach and a testing method that keep your content findable.

After this lesson you can explain how a script-heavy site is processed by Google, decide how to deliver content so it is dependable, and test what the crawler actually saw. You do not need to avoid JavaScript. You need to avoid hiding important content and links behind it.

How Google handles JavaScript

Google's JavaScript SEO documentation describes the same three phases you met earlier, with rendering made explicit:

  1. Crawling. Google checks robots.txt, fetches the URL and queues links it finds in the HTML.
  2. Rendering. For pages that return a success status, a headless Chromium runs the scripts and builds the final page. This may happen after the initial fetch, not instantly.
  3. Indexing. Google indexes the rendered HTML and extracts more links.

See rendering and indexing. The practical consequence: whatever appears only after scripts run depends on rendering working. It usually does, but it is an extra dependency and a delay, and not every other crawler or tool runs scripts the same way.

Rendering approaches

Approach What the server sends SEO notes
Static or pre-rendered HTML Complete HTML for each page, built ahead of time Simple and robust: crawlers see content at once
Server-side rendering (SSR) Complete HTML built on each request Robust; needs a server
Client-side rendering (CSR) A near-empty shell plus scripts Content only after scripts run; more fragile
Hybrid Server HTML first, scripts add interactivity Common in modern frameworks

Google recommends server-side rendering or pre-rendering because it helps users and crawlers that cannot run scripts. This site is built as exported static HTML pages, so the content and links are present in the HTML before any script runs. That makes verification simple: view source and the content is there.

Google finds links in <a> elements with an href. A client-side router should render real anchors and use the History API for clean URLs, not hash fragments.

html
<a href="/classes/sourdough/">Sourdough classes</a>
<a href="#/classes/sourdough">Sourdough classes</a>

The first is a normal link. The second relies on a fragment, which Google cannot reliably treat as a separate page. If your framework offers a link component, check it produces real anchors.

Status codes in single-page apps

If a server returns 200 for any path and the script then shows a "page not found" view, Google sees success with an error-looking page: a soft 404. Fixes in Google's guidance: redirect to a URL that returns a real 404, or add a noindex robots meta tag to the error view. Server-side or static output lets the server answer with the right status itself. See redirects and status codes.

Meta tags set by JavaScript

You can set titles, descriptions, canonicals and robots tags with JavaScript, and Google can read them after rendering. But:

  • If the HTML contains noindex, Google may skip rendering, so a script that removes it may never run. Do not ship noindex in the HTML on pages you want indexed.
  • Canonicals set by script should agree with any in the HTML. Google prefers the HTML.
  • The simplest rule: put all critical metadata in the HTML sent by the server.

Resources must be crawlable

If scripts and styles are blocked in robots.txt (robots.txt), Google may not render the page properly. Also, Google's rendering service may ignore cache headers, so file names that include a content hash help avoid stale files.

Other things that hide content

  • Lazy loading is fine if the content loads when scrolled into view in a way crawlers can trigger; follow Google's lazy-loading guidance, since content that needs a click or scroll that crawlers do not perform may be missed.
  • Content behind interaction: tabs and accordions that are in the HTML are fine; content fetched only after a user click is less safe.
  • Web components: content must be present in the rendered HTML, which is flattened.

Testing

Do not guess. Check:

  1. View source: what the server sent.
  2. Inspect element: the DOM after scripts.
  3. Search Console URL Inspection: shows the rendered HTML Google captured and any blocked resources (Search Console basics).
  4. Disable JavaScript in the browser and see what remains. You will find out quickly what a script-less visitor sees.

You can reproduce the difference using the HTML viewer.

html
<div id="app">Loading classes...</div>
<noscript>This page needs JavaScript to show the class list.</noscript>
<script>
  document.getElementById("app").innerHTML = "<h2>Sourdough classes</h2><a href='/classes/sourdough/'>Beginner course</a>";
</script>

Everything useful here exists only after the script runs. A static version would put the heading and link directly in the HTML.

Common mistakes

  • A client-rendered app with no server-side HTML, and no check of what Google saw.
  • Navigation built from clickable elements without hrefs.
  • Hash-based routes for indexable pages.
  • 200 responses for missing pages.
  • noindex in the initial HTML, removed later by script.
  • Blocking script or style folders.
  • Important text loaded only on user interaction.

Exercise

Take a page from a JavaScript-based site, or write one with the snippet above. Compare view source and inspect element, then list what the crawler needs: the heading, a paragraph of copy, and one link. Say which approach (static, SSR, CSR) would make each appear in the HTML.

Show the reasoning

In the snippet, view source shows only "Loading classes..." while the DOM shows the heading and link. With static pre-rendering or SSR, the heading and link would be in the HTML itself. If you must use client rendering, verify with URL Inspection that Google rendered the content, and ensure the link is a real anchor.

Key points

  • Google processes JavaScript pages in three phases: crawling, rendering and indexing; rendering can come after the first fetch.
  • Server-side rendering or pre-rendering is recommended because it helps users and crawlers that do not run scripts.
  • Links must be a elements with an href, with real URLs rather than hash fragments.
  • Single-page apps need real status codes or noindex on error views to avoid soft 404s.

Check yourself

1. Which link form can Google reliably follow?
2. Why is server-side rendering or pre-rendering recommended?
3. What is the soft-404 risk in a single-page app?
4. You add noindex in the HTML and plan to remove it with JavaScript. What may happen?

Free tools for this lesson