/lesson-22

JavaScript SEO: Ensuring Your App Gets Indexed

Learn how JavaScript affects SEO: client-side vs server-side rendering vs static generation, real links, per-page metadata and how to test.

Lesson 22 of 3015 min readUpdated Sep 27, 2026

Key takeaways

  • With client-side rendering, Google first sees an empty shell and has to render the JavaScript before it sees content.
  • Server-side rendering or static generation puts the full content, links and metadata in the first HTML response.
  • Use real <a href> links, set a unique title and meta description per route, and never block JS or CSS in robots.txt.
  • Check the rendered page with Search Console's URL Inspection and by loading the page with JavaScript turned off.

Modern web development has shifted heavily toward JavaScript frameworks like React, Vue, and Angular. While these frameworks create fantastic, app-like user experiences, they can create significant barriers for search engines if not configured correctly.

The core issue is Rendering. Googlebot is smart, but it is not a human user. If your content depends entirely on JavaScript execution in the browser, you risk being invisible.

1. The Problem: Client-Side Rendering (CSR)

By default, most Single Page Applications (SPAs) use Client-Side Rendering.

How it works:

The server sends a nearly empty HTML file (often just a <div id="root">). The browser then downloads a large JavaScript bundle, executes it, and populates the page with content.

What Google sees:

When Googlebot first crawls the URL, it sees the empty HTML shell.

The Risk:

Google can execute JavaScript, but it requires massive processing power. Therefore, Google defers this process.

  • First Wave (Crawl): Google sees the empty shell.
  • The Queue: The page waits in a render queue. Google says this is usually quick, but it is an extra step where content can be delayed or missed.
  • Second Wave (Render): Google finally executes the JS to see the content.

Bottom Line: Pure CSR can lead to delayed indexing and missed content if the rendering times out.

2. The Solution: Server-Side Rendering (SSR) & SSG

To ensure Google sees your content immediately, you must move the rendering process from the user's browser to the server (or build time).

A. Server-Side Rendering (SSR)

How it works: When a bot (or user) requests a page, the server executes the JavaScript, builds the full HTML string, and sends a fully populated page to the browser.

  • Benefit: Googlebot sees the full content (text, links, metadata) in the initial HTML response. Google does not have to wait for rendering to see the content.
  • Frameworks:
    • React: Use Next.js or Remix.
    • Vue: Use Nuxt.js.
    • Angular: Use Angular SSR (formerly Angular Universal).

B. Static Site Generation (SSG)

How it works: You generate all your HTML pages at build time (before deployment). The server serves simple static HTML files.

  • Benefit: Extremely fast performance (great for Core Web Vitals) and perfect SEO.
  • Use Case: Blogs, marketing sites, and pSEO projects.
  • Frameworks: Next.js, Gatsby, Astro.

Comparison: CSR vs. SSR vs. SSG

FeatureCSR (Client-Side)SSR (Server-Side)SSG (Static)
Initial HTMLEmpty (Loading...)Full ContentFull Content
SEO FriendlinessLow / RiskyHighHigh
Server LoadLowHighLow
Best ForDashboards, Private AppsDynamic Feeds, Social NetworksBlogs, Docs, Landing Pages

3. Critical Best Practices for JS SEO

Even with SSR, developers often make mistakes that hurt indexing.

A. Use Real Links (<a href>)

Googlebot discovers new pages by following links.

  • Bad: <div onClick={goToPage}>Product</div> (Googlebot doesn't click).
  • Good: <a href="/product">Product</a> (Googlebot follows this).

Note: In frameworks like Next.js, use the <Link> component, which renders an underlying <a> tag.

B. Managing Metadata (The <head>)

In a Single Page App, the <title> and <meta> tags often remain static (e.g., "My App") across every page.

The Fix: You must inject dynamic metadata for each route.

  • React: Use react-helmet-async or Next.js Metadata API.
  • Vue: Use @unhead/vue.

Verify: Check that the title changes in the browser tab when you navigate between pages.

C. Don't Block Resources

Ensure your robots.txt file does not block your JavaScript (.js) or CSS (.css) files. Google needs to access these files to render the page correctly.

4. How to Test Your JS App

Never guess; always verify what Google sees.

  • Google Search Console (URL Inspection): Enter your URL and click "Test Live URL". Click "View Tested Page" > "Screenshot". Result: If the screenshot is blank or shows a loading spinner, Google cannot see your content. If you see the text, you are safe.
  • Rich Results Test: This tool runs the actual Google rendering engine. If it can detect your Schema Markup, it generally means it rendered the page successfully.
  • Disable JavaScript in Chrome: Use a browser extension to turn off JS. Reload your page. If the screen is blank, you are relying entirely on CSR.

Conclusion

For modern SEO, Server-Side Rendering (SSR) or Static Site Generation (SSG) is the standard. While Google can index Client-Side Rendered apps, relying on it is like playing roulette with your rankings. By using frameworks like Next.js or Nuxt, you give search engines exactly what they want: fast, accessible, and fully rendered HTML.

/wizard

Put the course into practice

pSEO Wizard reads your website and writes one landing page per search, using only facts from your site.

Make my free page

Your first page is free. No card needed.