AEO for Next.js
Check the HTML your public Next.js routes return. Then set up metadata files and page-specific JSON-LD. The steps below say which parts apply to the App Router and which to the Pages Router.
Default robots.txt behavior
Next.js has file conventions for robots and sitemap files. Your application must supply their content. In the App Router, use app/robots.txt or app/robots.ts. Use app/sitemap.xml or app/sitemap.ts for the sitemap. In the Pages Router, static files can live in public/. A missing group for an individual AI bot is not a crawl failure in itself.
Decide whether to permit search and user-fetch crawlers separately from training crawlers, within the controls your platform provides. See how AEOprobe distinguishes crawler roles.
Default structured data
The Next.js JSON-LD guide renders a script with type application/ld+json in a page or layout. generateMetadata manages page metadata. It does not create that JSON-LD script for you. Both Server and Client Components can be pre-rendered into the initial HTML. So “use client” alone does not mean the page is empty.
Common AEO issues
| Issue | Impact | Fix |
|---|---|---|
| Important content is fetched only after hydration | ImpactThe initial response may omit the text a crawler needs. | FixInspect the public route’s initial HTML. If required content is missing, move it into server-rendered output. |
| JSON-LD is absent, unsafe or uses shared placeholder facts | ImpactThe published route has missing or misleading structured data. | FixRender a page-specific JSON-LD script from real content. Sanitize serialized values before you insert them into HTML. |
Step-by-step guide
- 1
Inspect a public route’s initial response
Check a static route and an important dynamic route. Confirm the page text is present before any client-side fetching. Use generateStaticParams only for paths you intend to pre-render. On-demand server rendering can be an intentional choice.
- 2
Configure files for your router
In the App Router, supply app/robots.ts and app/sitemap.ts, or their static file equivalents. In the Pages Router, you can use static public/robots.txt and public/sitemap.xml files. Include real public URLs and truthful modification dates. Then check the deployed responses.
- 3
Render page-specific JSON-LD
Add an application/ld+json script in the relevant page or layout, as the Next.js JSON-LD guide shows. Serialize values safely. Escape less-than characters that come from untrusted content. Publish, then compare a representative route’s script with its visible content.
Official documentation
- Next.js JSON-LD guide(opens in a new tab)
Native script rendering and safe serialization.
- Server and Client Components(opens in a new tab)
Initial HTML and hydration behavior.
- Next.js robots file convention(opens in a new tab)
Static and generated App Router crawler rules.
- Next.js sitemap file convention(opens in a new tab)
Static and generated App Router sitemaps.
- Pages Router public folder(opens in a new tab)
Serving static files from the site root.
- generateStaticParams(opens in a new tab)
Selecting dynamic paths to pre-render.
Questions
Does a Client Component hide all content from crawlers?
No. Next.js pre-renders Client Components for the first load too. Check whether your content appears in the initial response. Data fetched only on the client can still be missing from it.
Must every dynamic route use generateStaticParams?
No. It selects paths to pre-render. Choose the rendering approach that fits the route. Then check that important public URLs return the expected content.
The free audit checks up to 3 public pages with no sign-up. Structured data checks read JSON-LD only. Microdata and RDFa are not parsed. Findings do not guarantee rankings or AI citations.
A saved-site audit costs 20 credits. It covers up to 10 pages on Free, 50 on Watch and 100 on Pro. AEOprobe plans are Free at €0/month, Watch at €7/month and Pro at €21/month. Your account shows what you can buy.
Run the free audit on your site