[Rules](/rules) · fixes by platform

# How to fix crawler findings on Next.js

Where each fix is made on Next.js, including where Next.js does not let you make it and what to do instead. Every report on a Next.js site shows these steps under the finding they fix.

[WordPress](/fix/wordpress) · [Shopify](/fix/shopify) · [Webflow](/fix/webflow) · [Squarespace](/fix/squarespace) · [Wix](/fix/wix) · **Next.js** · [Drupal](/fix/drupal) · [Cloudflare](/fix/cloudflare)

## Edit robots.txt

- App Router: add app/robots.ts that returns a MetadataRoute.Robots object (rules per userAgent, sitemap URL). Pages Router or static export: put robots.txt in public/.
- Ship one of the two, not both: the route handler and a public/robots.txt collide.

Fixes these findings: [ROBOTS_RULES_SHADOWED](/rules#ROBOTS_RULES_SHADOWED), [ROBOTS_LEGACY_AGENT_ONLY](/rules#ROBOTS_LEGACY_AGENT_ONLY), [ROBOTS_GROUP_NAME_TYPO](/rules#ROBOTS_GROUP_NAME_TYPO), [ROBOTS_NOINDEX_LINE](/rules#ROBOTS_NOINDEX_LINE), [ROBOTS_SITEMAP_RELATIVE](/rules#ROBOTS_SITEMAP_RELATIVE), [ROBOTS_NO_SITEMAP](/rules#ROBOTS_NO_SITEMAP), [ROBOTS_NOT_200](/rules#ROBOTS_NOT_200), [ROBOTS_IS_HTML](/rules#ROBOTS_IS_HTML), [ROBOTS_IS_CATCHALL](/rules#ROBOTS_IS_CATCHALL), [ROBOTS_DISALLOW_ALL](/rules#ROBOTS_DISALLOW_ALL), [ROBOTS_CTYPE](/rules#ROBOTS_CTYPE), [ROBOTS_BLOCKED](/rules#ROBOTS_BLOCKED), [RENDER_RESOURCE_BLOCKED](/rules#RENDER_RESOURCE_BLOCKED), [INSTRUCTION_CONFLICT](/rules#INSTRUCTION_CONFLICT), [DECLARED_SITEMAP_REFUSED](/rules#DECLARED_SITEMAP_REFUSED), [DECLARED_SITEMAP_BROKEN](/rules#DECLARED_SITEMAP_BROKEN), [SITEMAP_BLOCKED](/rules#SITEMAP_BLOCKED), [AI_OPTOUT_SET](/rules#AI_OPTOUT_SET), [BOT_BLOCKED_NOT_CITED](/rules#BOT_BLOCKED_NOT_CITED), [BOT_RULES_SHADOWED_NOT_CITED](/rules#BOT_RULES_SHADOWED_NOT_CITED)

## Publish a sitemap

- App Router: app/sitemap.ts returning MetadataRoute.Sitemap, one entry per URL with lastModified set to the content's real change date.
- Reference it from app/robots.ts (sitemap field) so crawlers find it.

Fixes these findings: [NO_SITEMAP_FOUND](/rules#NO_SITEMAP_FOUND), [SITEMAP_NO_LASTMOD](/rules#SITEMAP_NO_LASTMOD), [SITEMAP_IS_HTML](/rules#SITEMAP_IS_HTML), [SITEMAP_DECLARES_NOTHING](/rules#SITEMAP_DECLARES_NOTHING), [SITEMAP_UNREADABLE](/rules#SITEMAP_UNREADABLE), [SITEMAP_ORIGIN_ERROR](/rules#SITEMAP_ORIGIN_ERROR), [ROBOTS_NO_SITEMAP](/rules#ROBOTS_NO_SITEMAP), [DECLARED_SITEMAP_BROKEN](/rules#DECLARED_SITEMAP_BROKEN), [SITEMAP_CHILD_BROKEN](/rules#SITEMAP_CHILD_BROKEN), [SITEMAP_URL_OFF_HOST](/rules#SITEMAP_URL_OFF_HOST), [SITEMAP_LASTMOD_INVALID](/rules#SITEMAP_LASTMOD_INVALID), [DECLARED_SITEMAP_REFUSED](/rules#DECLARED_SITEMAP_REFUSED)

## Publish llms.txt

- Put llms.txt in public/ for a static file, or add app/llms.txt/route.ts that returns it with content-type text/plain.

Fixes these findings: [NO_LLMS_TXT](/rules#NO_LLMS_TXT), [LLMS_LINK_BROKEN](/rules#LLMS_LINK_BROKEN), [NO_LLMS_TXT_NOT_CITED](/rules#NO_LLMS_TXT_NOT_CITED)

## Send HSTS

- next.config.js headers(): source '/(.*)' with Strict-Transport-Security: max-age=63072000; includeSubDomains. Some hosts send it already; check the live response before adding a second copy.

Fixes these findings: [HSTS_MISSING](/rules#HSTS_MISSING), [HSTS_PRELOAD_INELIGIBLE](/rules#HSTS_PRELOAD_INELIGIBLE), [HSTS_PRELOAD_REMOVED](/rules#HSTS_PRELOAD_REMOVED)

## Let crawlers through

- Check middleware.ts for user-agent checks, and your host's firewall: on Vercel, Firewall → Bot protection and Attack Challenge Mode challenge crawlers.

Fixes these findings: [CHALLENGE_SERVED_200](/rules#CHALLENGE_SERVED_200), [CHALLENGE_PINNED_AT_EDGE](/rules#CHALLENGE_PINNED_AT_EDGE), [ANSWER_ENGINE_REFUSED](/rules#ANSWER_ENGINE_REFUSED), [UNIFORM_REFUSAL](/rules#UNIFORM_REFUSAL), [HOMEPAGE_REFUSED](/rules#HOMEPAGE_REFUSED), [HOMEPAGE_IS_INTERSTITIAL](/rules#HOMEPAGE_IS_INTERSTITIAL), [ORIGIN_REFUSED_SCANNER](/rules#ORIGIN_REFUSED_SCANNER), [CRAWLER_SERVED_LESS](/rules#CRAWLER_SERVED_LESS), [CRAWLER_REDIRECTED_AWAY](/rules#CRAWLER_REDIRECTED_AWAY), [BOT_BLOCKED_NOT_CITED](/rules#BOT_BLOCKED_NOT_CITED)

## Serve the text, not just code

- Render content on the server: keep it in Server Components (the App Router default) or use getStaticProps / getServerSideProps; avoid "use client" at the page root and content fetched only in useEffect.
- Check View Source, not the browser inspector: the text must be in the HTML the server sends.

Fixes these findings: [PAGE_IS_MOSTLY_CODE](/rules#PAGE_IS_MOSTLY_CODE), [CONTENT_NEEDS_JAVASCRIPT](/rules#CONTENT_NEEDS_JAVASCRIPT)

## Fix the structured data

- Render one `<script type="application/ld+json">` per entity in the layout or page (JSON.stringify of the object), with a stable @id.

Fixes these findings: [ENTITY_COLLISION](/rules#ENTITY_COLLISION), [ENTITY_NO_COORDINATES](/rules#ENTITY_NO_COORDINATES), [GEO_COUNTRY_MISMATCH](/rules#GEO_COUNTRY_MISMATCH), [NAP_NAME_DRIFT](/rules#NAP_NAME_DRIFT), [NAP_UNDECLARED_LISTING](/rules#NAP_UNDECLARED_LISTING)

## Clear stale copies

- Revalidate (revalidatePath / revalidateTag or a shorter revalidate time) and redeploy; on a CDN, purge the paths that changed.

Fixes these findings: [STALE_CACHE_SERVED](/rules#STALE_CACHE_SERVED), [MACHINE_FILE_CACHE_STALE](/rules#MACHINE_FILE_CACHE_STALE), [MACHINE_FILE_CACHE_SPLIT](/rules#MACHINE_FILE_CACHE_SPLIT)

## Check the fix

Scan the site again on the [homepage](/): a fix counts when the finding is gone from the new report. JSON for tools: [/api/v1/fix/platform?platform=nextjs](/api/v1/fix/platform?platform=nextjs).

We read your site the way crawlers do, from our own network, and every report says exactly what was asked for and what came back. [Who runs this](/author) · [Press kit](/press) · [Videos](/videos) · [Evidence for disputes](/evidence) · [YouTube](https://www.youtube.com/@crawlcheck) · [hello@crawlcheck.io](mailto:hello@crawlcheck.io)

#### How we measure, and our own machine files

CrawlCheck reads every site as itself. Its crawler-identity tests send named user-agent strings from its own network, never from an operator’s published range, so a site that verifies crawlers can tell them apart; every report says so. Results reflect what an anonymous non-browser client receives. [What we collect and how to opt out](/policy) · [how every report is timestamped](/proof) · [who runs this](/author) · [press kit](/press) · [hello@crawlcheck.io](mailto:hello@crawlcheck.io).

**Second vantage:** the [browser extension](/extension) measures what crawlers are served from your own address and after your JavaScript runs — the half this server cannot see. From 1.0.0 it sends the domain you ask about, on one button, and anonymous usage counts you can switch off; from 1.0.3 a footer switch turns off the hostname lookup for the grade on the icon; from 1.0.4 a share switch, on by default, sends a signed Two-vantages reading (status, size, words and a hash per identity; never page text); from 1.0.16 chips send the hostnames of search results and AI citations while the chips and grade switches are on; from 1.0.17 a readings switch, on by default, sends one signed page reading a day (numbers, the hostname and the page address with the query removed; never in incognito; at most 40 a day) and only while the share and grade switches are also on. Earlier versions send nothing.

**Our own machine layer for the agentic web:** [llms.txt](/llms.txt) · [llms-full.txt](/llms-full.txt) · [agents.md](/agents.md) · [SKILL.md](/SKILL.md) · [entitymap.json](/entitymap.json) · [media kit](/.well-known/media-kit.json) · [MCP server card](/.well-known/mcp/server-card.json) · [API catalog](/.well-known/api-catalog) · [OpenAPI](/openapi.json) · [robots.txt](/robots.txt) · [sitemap.xml](/sitemap.xml) · [security.txt](/.well-known/security.txt) — every one named in robots.txt, which is exactly what we check for on yours.

**Pages:** [Certificates](/certificates) | **Registry:** [MCP: Operator](/registry/mcp/operator) · [MCP](/registry/mcp) · [AI policy](/registry/aipolicy) · [app.alkhemyst-ai.cloud](/registry/app.alkhemyst-ai.cloud) · [bestvaluelandscapingandfencing.com](/registry/bestvaluelandscapingandfencing.com) · [business.yelp.com](/registry/business.yelp.com) · [community.spiceworks.com](/registry/community.spiceworks.com) · [deckardlab.tech](/registry/deckardlab.tech) · [dougburkephoto.com](/registry/dougburkephoto.com) · [farcholabs.com](/registry/farcholabs.com) · [geniusmonkey.com](/registry/geniusmonkey.com)

[Contact](/contact) · [Partnerships](/partnerships) · [Terms of service](/terms) · [Refund policy](/refunds) · [Trust center](/trust) · [Subprocessors](/subprocessors) · [Changelog](/changelog) · [Report an error](/report-error)
