Prompt
How do I make a React or Next.js site easier for search engines to crawl?
Latest observation
To make a React or Next.js site easier for search engines to crawl, the big goal is: make sure important content is present in the initial HTML, easy to discover, and linked clearly.
Best practices
1) Prefer server-side rendering or static generation
If your pages are rendered only in the browser, crawlers may miss or delay indexing content.
- Next.js: use SSG (
getStaticProps/ App Router static rendering) or SSR where appropriate. - Keep important marketing/content pages server-rendered when possible.
2) Make sure content is in the HTML, not only after JS runs
Search engines can execute JS, but it’s slower and less reliable than plain HTML.
- Render page titles, headings, body content, and internal links on the server.
- Avoid putting key text behind client-only state or fetches that happen after load.
3) Use proper metadata
Every page should have:
- unique
<title> <meta name="description">- canonical URL
- Open Graph / Twitter tags if relevant
In Next.js, use:
- App Router:
metadata/generateMetadata - Pages Router:
next/head
4) Create clean internal linking
Crawlers discover pages through links.
- Use normal
<a>links for navigation. - Make sure important pages are reachable within a few clicks.
- Avoid hiding important routes behind complex JS actions.
5) Generate a sitemap.xml
This helps crawlers find your pages.
- Include all indexable URLs.
- Update it when routes change.
- Submit it in Google Search Console / Bing Webmaster Tools.
6) Use robots.txt correctly
- Don’t accidentally block pages you want indexed.
- Block only non-public, duplicate, or low-value areas if needed.
- Reference your sitemap in
robots.txt.
7) Handle duplicate URLs with canonical tags
If the same content can be reached via multiple URLs, use canonical URLs to tell search engines which one is preferred.
8) Avoid rendering only via client-side navigation for critical content
Client-side routing is fine, but the initial page load should still provide crawlable content.
- Don’t rely on
useEffectto fetch the main content if SEO matters. - If data must be fetched client-side, consider SSR/SSG for the important parts.
9) Improve performance and Core Web Vitals
Search engines favor sites that load quickly and render reliably.
- Optimize images with
next/image - Reduce JavaScript bundle size
- Use lazy loading where appropriate
- Minimize layout shift and long main-thread work
10) Ensure pages return correct HTTP status codes
200for valid pages404for missing pages301for permanent redirects
This helps crawlers understand your site structure.
11) Use structured data where appropriate
Add schema.org JSON-LD for things like:
- articles
- products
- FAQs
- breadcrumbs
- organization
This can improve how search results display your site.
Next.js-specific tips
If you’re using Next.js, the easiest SEO improvements are usually:
- use App Router or SSG
- add metadata
- generate a sitemap
- configure robots.txt
- use server components for content-heavy pages
- use dynamic routes with proper canonical URLs
What to avoid
- rendering meaningful content only after client-side fetches
- blocking crawlers with
robots.txtby accident - missing titles/meta descriptions
- duplicate pages without canonicals
- infinite faceted/filter URLs being indexed
If you want, I can give you a Next.js SEO checklist or a sample setup for App Router with metadata, sitemap, and robots.txt.