Skip to content

JavaScript SEO basics: what to check when a site relies on JavaScript

How Google processes JavaScript pages, the problems that stop content being indexed, and how to test for them.

· 3 min read

Many modern sites build their pages with JavaScript frameworks. Google can process JavaScript, but there are more ways for it to go wrong than with plain HTML. This guide covers how Google handles JavaScript pages, according to its own documentation, and the checks worth doing on any JavaScript-heavy site.

How Google processes JavaScript pages

Google describes three main phases: crawling, rendering and indexing.

  1. Googlebot fetches the URL and reads the HTML it gets back.
  2. Pages are queued for rendering. A headless Chromium browser runs the JavaScript and produces the rendered page.
  3. Google indexes the rendered content and finds further links in it.

The practical consequence: content and links that exist only after JavaScript runs depend on that rendering step working. Content that is in the initial HTML does not.

The checks that matter

Can Google see the content?

Use the URL Inspection tool in Google Search Console and look at the rendered HTML and screenshot. Check that the main content, headings and links are there. A content check in the rendered HTML is more reliable than looking at the page in your own browser, which may be logged in or have cached data.

Are links real links?

Google can reliably follow links only when they are <a> elements with an href attribute containing a URL. Navigation built from buttons, or from elements with click handlers and no href, may not be followed. Check your menus, pagination and "load more" controls.

Does each page have its own URL?

Single-page applications should use the History API to give each view a real URL, not fragments (#/products). Google's guidance is that it cannot reliably resolve fragment URLs, so views that differ only after the # may not be treated as separate pages.

Do error pages return error status codes?

Single-page apps often show "not found" content while the server returns status 200. Google may treat these as soft 404s. Return a real 404 status where you can, or, if not, redirect to a URL that does, or add a noindex robots meta tag to the error view.

Is noindex handled correctly?

If the initial HTML contains noindex, Google may skip rendering the page, so JavaScript that later removes the noindex may never run. Do not rely on JavaScript to change noindex to indexable.

Are titles, descriptions and canonicals right after rendering?

JavaScript can set the title, meta description and canonical, and Google will generally use the rendered values. Check that every route sets its own and that they do not conflict with the values in the initial HTML.

Is lazy-loaded content loaded?

Content loaded only when someone scrolls or clicks may not be seen. Google's guidance is to make sure lazy-loaded content loads when it becomes visible in the viewport, rather than depending on user actions such as scrolling or clicking.

Are resources blocked?

If robots.txt blocks the JavaScript or API endpoints needed to build the page, Google cannot render it properly. Check the page resources reported by the URL Inspection tool.

Rendering choices

Server-side rendering, static generation, or a hybrid of the two puts the content in the initial HTML. That makes pages faster for users and less dependent on rendering for search engines. Google has described dynamic rendering (serving crawlers a different, pre-rendered version) as a workaround rather than a long-term solution.

If you are choosing a framework setup for a new site, prefer one that can render the main content on the server.

A quick test routine

  1. Inspect a sample of URLs of each template in Search Console and check the rendered HTML.
  2. Crawl the site with a crawler that can render JavaScript, such as Screaming Frog or Sitebulb, and compare the links and content found with and without rendering.
  3. Request a URL that should not exist and check the status code.
  4. Check PageSpeed Insights for templates that are slow to show their main content.

For the wider checklist, see A technical SEO checklist for new sites. Questions about a specific framework? Ask in the Technical SEO community.

Comments (0)

Sign in to join the discussion.