Back to blog
technicalreactseo

The Complete Guide to SEO with React Router v7 and SSR

By Loïs Bibehe··8 min read
Code displayed on a dark screen

If you're building a React application that needs to rank in search engines (and let's be honest, most applications do), you need server-side rendering. Client-side rendered React apps are notoriously difficult for search engines to crawl. Google has improved its JavaScript rendering, sure, but relying on it is a gamble you don't need to take.

React Router v7 makes SSR a first-class citizen, and when combined with the right SEO patterns, it gives you everything you need to build fast, crawlable, and well-indexed web applications. This guide covers the complete setup.

Why SSR Matters for SEO

When a search engine crawler visits a client-side rendered React app, it receives an empty HTML shell with a JavaScript bundle. The crawler then needs to execute that JavaScript to see the actual content. This introduces several problems:

  • Rendering delays: Googlebot has a crawl budget. If your page takes time to render, it may not wait for all the content to appear.
  • Missing meta tags: Dynamic meta tags set via JavaScript may not be picked up reliably by all crawlers.
  • No content in the initial response: Other search engines like Bing and DuckDuckGo have less sophisticated JavaScript rendering than Google.
  • Social sharing fails: Social media platforms like Twitter and LinkedIn don't execute JavaScript. Without SSR, your Open Graph tags won't be present when someone shares a link.

With SSR, the server sends fully rendered HTML to the browser. Crawlers see the complete content, meta tags, and structured data on the first request. No JavaScript execution required.

React Router v7's SSR Architecture

React Router v7 introduced a powerful SSR model built around loader functions and the meta export. Each route module can export a loader function that runs on the server, fetching data before the page renders. This data is then available both for rendering the component and for generating meta tags.

The key insight is that your SEO metadata and your page content come from the same data source. This eliminates the common problem of meta tags being out of sync with page content.

The Meta Function Pattern

Each route module can export a meta function that receives the loader data and returns an array of meta tag descriptors. Here is a typical pattern for a blog post page:

The meta function receives the loader data via data and can use it to generate title tags, meta descriptions, Open Graph tags, and Twitter Card tags all in one place. Because the loader runs on the server, these tags are present in the initial HTML response. That's exactly what search engines need.

Essential Meta Tags

For every page on your site, you should include at minimum:

  • Title tag: Unique, descriptive, under 60 characters. Include your primary keyword near the beginning.
  • Meta description: A compelling summary under 160 characters. This is what appears in search results.
  • Canonical URL: Tells search engines which version of the page is authoritative, preventing duplicate content issues.
  • Open Graph tags: og:title, og:description, og:image, og:url, og:type. These control how your page appears when shared on social media.
  • Twitter Card tags: twitter:card, twitter:title, twitter:description, twitter:image. Similar to Open Graph but specific to Twitter.

JSON-LD Structured Data

Structured data helps search engines understand the content and context of your page. It powers rich results like FAQ snippets, article cards, and breadcrumbs in search results.

For a blog, you'll want to use the Article or BlogPosting schema type. This tells Google that your page is an article and provides metadata like the author, publish date, and headline. When implemented correctly, this can result in enhanced search result appearances with author information, dates, and images.

The JSON-LD script tag should be included in the page HTML. In React Router v7, you can render it directly in your component since SSR ensures it appears in the initial HTML. Place the script tag with type="application/ld+json" containing your structured data object.

Common Schema Types for Startups

  • Organization: For your company or project homepage
  • BlogPosting: For individual blog posts
  • FAQPage: For FAQ sections. These often get rich results.
  • Product: For product pages with pricing information
  • BreadcrumbList: For navigation breadcrumbs

Canonical URLs and Duplicate Content

Duplicate content is one of the most common SEO problems, and it's easy to create accidentally. URLs with trailing slashes, query parameters, and www vs non-www versions can all create duplicates. The canonical link tag tells search engines which URL is the "real" one.

In React Router v7, you can set canonical URLs in the meta function using the tagName: "link" format. Make sure your canonical URLs are absolute (including the domain) and consistent across your site.

Performance and Core Web Vitals

Google uses Core Web Vitals as a ranking factor. SSR gives you a head start here because the initial HTML contains real content, which improves Largest Contentful Paint (LCP). But there are additional steps you should take:

  • Stream your HTML response using React Router v7's streaming support to improve Time to First Byte (TTFB).
  • Minimize layout shifts by setting explicit dimensions on images and containers.
  • Defer non-critical JavaScript to improve First Input Delay (FID) and Interaction to Next Paint (INP).
  • Use the prefetch behavior in React Router links to preload data for pages users are likely to visit next.

Practical Checklist

Before launching any page, run through this checklist:

  • View the page source (not the rendered DOM) and confirm your content, meta tags, and structured data are present in the raw HTML
  • Test your Open Graph tags with the Facebook Sharing Debugger and Twitter Card Validator
  • Validate your structured data with Google's Rich Results Test
  • Check your canonical URLs resolve correctly and are consistent
  • Run a Lighthouse audit and address any SEO warnings
  • Test with JavaScript disabled to see what crawlers see

SEO isn't a one-time setup. It's an ongoing practice. But getting the technical foundation right with SSR means you're building on solid ground. Every piece of content you publish after this will benefit from the work you do now.

If you're building a startup and want your content to drive organic growth, building a community around that content is just as important as the technical SEO. The best results come from combining both.

Loïs Bibehe

Loïs Bibehe

French developer helping founders build products. Work with us or learn to build it yourself. Your call.