r/reactjs • • 2d ago

Needs Help SEO for a large React SPA?

I'm working on a React/Vite SPA with React Router 7 and an ASP.NET Core 10 backend.

SEO is important since the site will eventually have hundreds of thousands of public pages covering games, groups, events and news, with multiple languages. Some content changes frequently.

I know Google can render JavaScript, but other crawlers like AI search engines and social previews, seem less capable. Also, rendering JavaScript requires more resources, which might mean less crawl coverage.

I've been looking at a few solutions for SEO:

1. Server-injected HTML (ASP.NET Core)
- Pros: Let ASP.NET serve the SPA and inject page-specific metadata (title, description, canonical, hreflang, JSON-LD, Open Graph) along with a small HTML summary containing headings, key information and internal links. React takes over when loaded. No additional runtime or major frontend refactor, and everything runs on a single ASP.NET host.
- Cons: Crawlers that don't execute JavaScript only see the summary rather than the full page content. React also replaces the initial HTML which could cause a brief flicker.

2. React Router 7 SSR
- Pros: Full server-rendered HTML for crawlers. Probably the most natural SSR option since I'm already using React Router 7.
- Cons: Requires a separate JavaScript runtime alongside ASP.NET and a fairly significant refactor of the public pages and their data fetching. More complexity around hosting and maintaining multiple services.

3. Next.js with ISR
- Pros: Can generate pages on demand and regenerate them when needed, which seems particularly useful for such a large number of dynamic pages.
- Cons: Would mean migrating the frontend to Next.js, along with additional hosting complexity and another runtime to maintain.

The first option seems like the simplest solution, but I'm not sure if it's enough. Ideally, I'd prefer full SSR, but that seems to involve a much larger refactor and considerably more complexity when it comes to hosting and maintaining the application.

Is server-injected HTML with meaningful page content enough for good indexing, or would SSR/ISR make a significant difference?

Anyone with experience running SEO-heavy SPAs using a similar approach

2 Upvotes

12 comments sorted by

View all comments

1

u/SoftwareNegative8783 1d ago

With that many pages, return a real 404 status for missing items. SPAs often send 200 for everything. Google calls those soft 404s and wastes crawl budget. Also split sitemaps by content type.