Generative engine optimization on Next.js: check what bots receive
If a Next.js page builds its main text in the browser, a crawler that skips JavaScript gets an empty shell. Test with JavaScript off, then server-render.
The short answer
For generative engine optimization on Next.js, check what a crawler receives before anything else. If a page builds its main text in the browser, a crawler that doesn't run JavaScript gets an empty shell. Fetch key pages with JavaScript switched off, compare with what users see, and server-render any answer-bearing content. Skip llms.txt and chopped-up content: Google says Search needs neither.
A Next.js site can look perfect in a browser and be nearly blank to a bot. Next.js can render pages on the server, but a component marked 'use client' that fetches its text after the page loads hands crawlers a heading, a navigation bar and a loading spinner. For generative engine optimization on Next.js, that's the first thing to rule out, because no amount of good writing helps if the writing never arrives.
Google renders JavaScript for its own index, though rendering can lag behind crawling. Which AI crawlers run JavaScript at all isn't confirmed on the sources we checked, so the safe assumption is that some don't, and the only reliable answer for your site is to test it.
How do you check what bots receive from a Next.js page?
Compare the raw HTML your server sends with the page a visitor sees, on the five pages that matter most. The steps take under an hour.
- Pick five pages buyers rely on: a main service or product page, the pricing page, a comparison page, a key article and the contact page. Copy one distinctive sentence from the body of each.
- Fetch each page's raw HTML without running scripts. From a terminal, curl -s followed by the URL, piped to grep with your sentence, prints the line if it's in the HTML. Without a terminal, open the page in Chrome, turn JavaScript off in DevTools settings and reload. If curl returns a 403 or a challenge page, your firewall or bot protection is blocking scripted requests, and some crawlers will be blocked the same way: note it and go to step six.
- Check Google's view. In Google Search Console, run URL Inspection on each page, test the live URL and read the rendered HTML. If your sentence is there, Google can read it. If it isn't, Google is seeing the shell too.
- Find the component that builds the missing text. Look for 'use client' components that load content in a useEffect hook or a client-side data library, dynamic imports with ssr set to false, and CMS content fetched from the browser.
- Move that content to the server. In the App Router, fetch data in a Server Component and pass it down as props, keeping only the interactive parts as client components. In the Pages Router, use getStaticProps or getServerSideProps. Static generation with revalidation suits most marketing pages.
- Check access as well as rendering. Read the output of app/robots.ts or public/robots.txt, check any middleware that redirects or blocks by user agent, and ask whoever runs your hosting whether bot protection is on. A page that renders perfectly but returns a challenge to crawlers is no better than an empty one.
- Check the head. Titles, meta descriptions and canonical tags should come from the metadata export or generateMetadata, not be set in the browser after load.
- Re-run steps two and three after each fix and record the result for all five pages.
Symptoms, causes and fixes
| What you see with JavaScript off | Likely cause | Fix |
|---|---|---|
| Heading and navigation only, body missing | Body text fetched in a client component after load | Fetch in a Server Component or at build time |
| A loading spinner where content should be | Suspense fallback with client-only data | Render the content on the server. Keep the spinner for truly live data |
| Tabs or accordions with only the first panel's text | Hidden panels mounted only on click | Render every panel's text in the HTML and toggle visibility with CSS |
| Prices or specifications missing | Values pulled from a client-side API | Fetch on the server, with revalidation if they change often |
| Generic title on every page | Title set in a client effect | Use the metadata export or generateMetadata |
| A 403, a challenge page or a redirect | Firewall, bot protection or middleware | Allow the crawlers you want. Check logs to confirm |
Tabbed and accordion content deserves a second look. Text that only exists after a click can't be read by a crawler that doesn't click, and the answers buyers want, like pricing details and limits, are often the ones tucked into tabs.
What to skip
- An llms.txt file as the fix. It's a proposal published in 2024, not an adopted standard, and Google's guide to its generative AI features says Search doesn't use it. Add one if you like, but not instead of server rendering. The llms.txt entry has the background.
- Breaking content into tiny chunks for AI. Google's same guide says content doesn't need to be chopped up that way, and Google says AI Overviews and AI Mode need nothing beyond normal SEO best practice.
- Separate bot-only pages. Serving crawlers different content from visitors invites the problems Google's spam policies describe. Serve everyone the same server-rendered page.
Where this fits in a wider check
Rendering is one part of whether AI crawlers can use your site. Access and crawlability are the others. Running an AI SEO audit yourself puts this check alongside the buyer-question test and Search Console, and GEO for WordPress covers the same ground for a different platform.
If your site needs rebuilding so the important text renders on the server, that's the kind of job our web design service takes on. Before that, run step two on your pricing page today: it's the page most often built in the browser and the one buyers' questions need most.
Questions people ask
Is Next.js good for SEO and AI search?
Yes, when pages are rendered on the server or generated at build time, which Next.js does well. Problems start when important text is fetched in client components after the page loads. Check key pages with JavaScript switched off, and move any missing content into Server Components or static generation.
Do AI crawlers render JavaScript?
Google renders JavaScript for its index. Whether other AI crawlers do isn't confirmed on our sources and may differ by crawler, so assume some don't. Serving the main text in the initial HTML removes the question entirely, which is why server rendering is the safest choice for pages you want cited.
Does a Next.js site need an llms.txt file?
Not for Google. Google's guide to generative AI features in Search says it doesn't use llms.txt and that new machine-readable files aren't needed. You can add one for other services if you like, but it doesn't replace server-rendered content, which every crawler can read.
How do I see the HTML Googlebot gets from my Next.js page?
Use URL Inspection in Google Search Console, test the live URL and open the rendered HTML. Search it for a sentence from the page body. If the sentence is missing, Google is seeing a shell, and the component building that text needs to render on the server.