A robots.txt that blocks /_next/ blocks your CSS and scripts
Until 30 November 2026 the jexcellence.de robots.txt disallowed /_next/. What lives in that folder, the fix and the test that keeps it fixed.Until 30 November 2026 the robots.txt of jexcellence.de contained the line Disallow: /_next/. The rule had been in the repository since 3 May 2026. That path is where Next.js serves the site's stylesheets, scripts and font files. This post shows how to find the same line on your own site, what the fix looks like, and why the problem was known for four weeks before anyone fixed it.
Next.js generates robots.txt from app/robots.ts. Since the commit of 3 May 2026 that created the file, it looked like this:
Two things matter here: the "/_next/" entry and the host line.
The reasoning behind the rule is easy to follow. /_next/ looks like an internal folder and holds no pages, so keep it out of the index. But it holds everything a page needs in order to look like itself.
The page source of the home page answers that:
On 1 December 2026 the German home page loaded five stylesheets and 19 scripts. All 24 URLs start with /_next/. Not one script on the page comes from any other path. The fonts sit there too, under /_next/static/media/, since the site stopped loading fonts from Google.
A Disallow rule matches every path that starts with its value. Google's robots.txt documentation describes it that way, and the standard, RFC 9309, defines it in section 2.2.2. A crawler that obeys robots.txt was allowed to fetch the HTML pages but none of their stylesheets or scripts.
Google says two things about this. Its introduction to robots.txt advises against blocking resource files when the page is harder to understand without them. And its JavaScript SEO basics state that Google Search does not render JavaScript from blocked files.
Two requests are enough:
The first prints the rules. The second prints the paths your page loads scripts from. If a path from the second output falls under a Disallow line from the first, you are blocking files the page needs to render. For stylesheets, swap the pattern in the second command for '<link[^>]*href="[^"]*\.css[^"]*"'.
This is not specific to Next.js. Every framework has a folder for built files, and every one of those folders looks internal.
The commit from 30 November 2026 touches one file, adding three lines and removing two:
/api/ stays blocked. It holds endpoints, not pages and not files a page needs to render.
The host line is gone as well. The Next.js type MetadataRoute.Robots has an optional host field, so TypeScript never complained about it. But RFC 9309 defines only User-agent, Allow and Disallow and leaves further lines to the crawlers. Google also supports Sitemap and says its parser ignores other rules. A Host line is on neither list. The site's address is in the sitemap line and in every page's canonical anyway.
This is what the site serves now, fetched on 1 December 2026:
app/robots.ts is a plain function. You can call it without a server or a build. The test in app/site-files.test.ts swaps the domain for a placeholder and compares the result:
toEqual is strict on purpose. Anyone who adds another disallow rule later has to change the test too, and reads its name while doing so: only the API is blocked, /_next/ stays crawlable. The last assertion makes sure host does not come back.
Nobody missed the robots.txt. The site's daily check read it from 9 November 2026 onward and wrote the same note into every log: non-standard Host line, /_next/ disallowed. That is 22 logs in a row, up to 30 November, each time filed under minor observations with no backlog item, usually marked "unchanged".
A note repeated 22 times without change stops being read. The line was fixed only when it became a backlog item of its own on 30 November, with a number, a stated change and an acceptance check. After that it took one commit.
The lesson is not a technical one. An observation without a task is a finding nobody owns. Turn it into a task, or strike it and write down why.
Whether the rule cost the site anything in search has not been measured. No search console data was looked at for this post. What is documented is what the file said, what the page loads from /_next/, what Google writes about blocked files, and what the site serves since the fix.
- Open your /robots.txt and compare each Disallow line with the CSS and script paths in your page source.
- In Next.js, /_next/ does not belong in disallow.
- Block only what no page needs to render, such as /api/.
- Write a test that compares the full result of robots().
- Turn a repeated observation into a task, or strike it.