Single Page Application SEO: A Practical Guide
Single page apps often send search engines an almost empty HTML shell and build the page with JavaScript later. Google can render JavaScript, but it happens after a delay and other crawlers may not. Fix it by serving real HTML per URL through server rendering, static generation or prerendering, with a unique title, description and canonical on every route.
| Fix | Why |
|---|---|
| Real HTML for each public URL | Crawlers and link previews see content straight away |
| Unique title, description, canonical per route | Each page can rank and be shared on its own |
| A real path per view and a sitemap | Every page can be discovered and indexed |
Updated
This site is itself a React single page app that prerenders every public page at build time, so these are the checks we run on our own pages. Paste a page's source into the checker to see what a crawler gets before any JavaScript runs.
Need the tags written for you? Try the meta tag generator.
Page source checker
Paste the HTML from View Page Source to check what a crawler receives.
SPA SEO checklist
- Every public page has its own URL path (no # routes)
- View source (not Inspect) shows the page's heading and main text
- Each route has a unique title and meta description
- Each route has a canonical link to itself
- Navigation uses real a elements with href
- Unknown URLs return a 404 status or carry noindex
- A sitemap lists every public URL and is submitted in Search Console
- robots.txt does not block JavaScript or CSS files
- URL Inspection's rendered HTML shows the full content
- Logged-in and private screens are noindex or behind a login
SSR, static generation or prerendering
| Approach | How it works | Good for | Cost |
|---|---|---|---|
| Server-side rendering (SSR) | The server renders each request to HTML, then React hydrates it | Pages that change per request or per user | Needs a server; more moving parts |
| Static generation (SSG) | Pages are rendered to HTML at build time | Marketing pages, docs, blogs | Rebuild to update content |
| Build-time prerendering of an existing SPA | A script loads each route in a headless browser at build time and saves the HTML | An existing client-only app you do not want to rewrite | Build gets slower as routes grow |
| Client-side only | The server sends an empty shell; JavaScript builds the page | Logged-in app screens that should not be indexed | Public pages rely on Google rendering them later |
Fixes with code
Per-route title and description in React 19
React 19 lets any component render title, meta and link tags; React moves them into the document head. Each route sets its own.
export function PricingPage() {
return (
<>
<title>Pricing | Harbour Cafe Catering</title>
<meta name="description" content="Catering packages from $12 a head, with delivery across the harbour district." />
<link rel="canonical" href="https://example.com/pricing" />
<h1>Catering pricing</h1>
{/* ... */}
</>
);
}The same with react-helmet-async (React 18 and earlier)
Wrap the app once in HelmetProvider, then set tags per page. The async version is safe for server rendering and prerendering.
import { Helmet, HelmetProvider } from "react-helmet-async";
export function App() {
return <HelmetProvider><Routes /></HelmetProvider>;
}
export function PricingPage() {
return (
<>
<Helmet>
<title>Pricing | Harbour Cafe Catering</title>
<meta name="description" content="Catering packages from $12 a head." />
<link rel="canonical" href="https://example.com/pricing" />
</Helmet>
<h1>Catering pricing</h1>
</>
);
}Real URLs, not hash fragments
Google ignores everything after a # when deciding what a URL is. Use the History API (BrowserRouter, createBrowserRouter) so each view has its own path.
// Avoid: https://example.com/#/pricing
// Use: https://example.com/pricing
import { createBrowserRouter, RouterProvider } from "react-router-dom";
const router = createBrowserRouter([
{ path: "/", element: <Home /> },
{ path: "/pricing", element: <PricingPage /> },
{ path: "*", element: <NotFound /> },
]);Crawlable links
Crawlers follow a elements with an href. A click handler on a div is invisible to them. Router Link components render a real anchor.
// Crawlable
<Link to="/pricing">Pricing</Link> {/* renders <a href="/pricing"> */}
// Not crawlable
<div onClick={() => navigate("/pricing")}>Pricing</div>Avoid soft 404s for unknown routes
A client-only app answers every URL with status 200, so a missing page looks like a real one. Add a noindex to the not-found view, or serve a real 404 from the server or the prerender step.
export function NotFound() {
return (
<>
<title>Page not found | Harbour Cafe</title>
<meta name="robots" content="noindex" />
<h1>We could not find that page</h1>
<a href="/">Go to the home page</a>
</>
);
}A sitemap of every public route
List each public URL once, with its canonical address. Generate it from the same route list your app uses, so they never drift apart.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://example.com/</loc><lastmod>2026-10-01</lastmod></url>
<url><loc>https://example.com/pricing</loc><lastmod>2026-09-12</lastmod></url>
<url><loc>https://example.com/menu</loc><lastmod>2026-09-30</lastmod></url>
</urlset>
Testing like Google
In Search Console, URL Inspection shows whether a page is indexed and, with Test live URL, the HTML Google rendered and any resources it could not load. Compare that HTML with your visible page: headings, main text and links should all be there.
How it works
- Open a page, choose View Page Source, and copy all of it.
- Paste it into the checker below.
- Read which basics are present in the raw HTML and which are missing.
- Fix the gaps with one of the approaches and code samples on this page.
- Confirm with Search Console's URL Inspection, which shows the HTML Google rendered.
Tips
- Check View Source, not the Elements panel; the panel shows the page after JavaScript ran.
- Keep the prerendered HTML identical to what users see; different content for crawlers is cloaking.
- Do not block /assets or .js files in robots.txt; Google needs them to render.
- Social networks' link previews do not run JavaScript, so per-route Open Graph tags must be in the HTML.
Frequently asked questions
Can Google index a React single page app?
Yes. Google renders JavaScript, but pages wait in a render queue and anything that fails to load is missed. Other search engines and link-preview bots render less or not at all, so serving HTML is the safer choice.
Do I need Next.js for React SEO?
No. Next.js makes server rendering and static generation easy, but a Vite or Create React App style SPA can prerender its public routes at build time and get the same crawlable HTML.
Is react-helmet still needed in React 19?
Not for basic tags. React 19 renders title, meta and link elements from any component and moves them into the head. react-helmet-async remains useful on React 18 and earlier.
Is prerendering cloaking?
Not when crawlers and people get the same content. Prerendering only saves the page your users would see anyway. It becomes cloaking if the HTML served to bots says something different.
Related: Meta tag generator, XML sitemap generator, robots.txt tester, React Router examples, All free tools.
Build your site free or see all free tools. On We.Inc you can build your site free, with no card and no trial needed to start. AI building is on paid plans from $20 a month.
More in Guides
- SPF, DKIM and DMARC: The Three Records Behind Trusted Email
- SQL Joins Explained with Live Examples
- SSE vs WebSocket: Pick the Right Stream
- SSL Certificate Types: DV, OV, EV, Wildcard and SAN
- Static Site Generators Compared, with Measured Build Times
- Sticky Header: CSS position: sticky and Hide-on-Scroll
- Stripe Payment Links: Setup, Website Buttons and Thank-You Pages
- Stripe vs PayPal: Which Should Your Website Use?
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App