Does Your robots.txt Block the CSS and JavaScript Google Needs?
Google says you can block unimportant scripts or styles, but not ones that make a page harder to understand. How to open /robots.txt, match Disallow lines (including /_next/) to your CSS/JS, and what to ask.
Google says you can use robots.txt to block unimportant scripts or styles, but if missing those resources makes a page harder for Google's crawler to understand, don't block them. Googlebot skips disallowed URLs, and Google Search won't render JavaScript from blocked files. If your robots.txt has a broad rule like Disallow: /_next/ (or another folder that holds your real CSS and JavaScript), open /robots.txt, list the CSS/JS paths your homepage loads, and see whether they fall under that rule — then ask your developer or agency whether Googlebot should be allowed to fetch them.
Quotes below were last checked on November 5, 2026. This sits next to the "as a machine" steps in How to tell if your marketing agency is working; not a PageSpeed replacement.
What robots.txt does (30 seconds)
"A robots.txt file tells search engine crawlers which URLs the crawler can access on your site" (Introduction to robots.txt). "A robots.txt file lives at the root of your site." Owners usually open something like https://example.com/robots.txt (Create and submit a robots.txt file).
"Unless you specify otherwise in your robots.txt file, all files are implicitly allowed for crawling" (same page). The spec: "By default, there are no restrictions for crawling for the designated crawlers" (How Google interprets the robots.txt specification). You can leave the file empty, or not have one at all, "if your whole site may be crawled" (Robots Refresher). A Disallow names "A directory or page, relative to the root domain, that you don't want the user agent to crawl" (Create a robots.txt file) — paths that "must not be accessed by the crawlers identified by the user-agent line the disallow rule is grouped with" (robots.txt specification).
What Google says you may block — and what not to block
You "can use a robots.txt file to block resource files such as unimportant image, script, or style files". The limit: "However, if the absence of these resources make the page harder for Google's crawler to understand the page, don't block them, or else Google won't do a good job of analyzing pages that depend on those resources" (Introduction to robots.txt).
"Be sure to block only non-critical resources—that is, resources that aren't important to understanding the meaning of the page (such as decorative images)" (Troubleshoot crawling and indexing errors). A 2014 post adds that fonts, social buttons, and analytics scripts "tend not to meaningfully contribute to the visible content or layout, and can be left disallowed from crawling" (Rendering pages with Fetch as Google). Blocking analytics can be fine; blocking layout CSS/JS is different.
Why CSS and JavaScript matter for how Google sees your page
"Googlebot reads the robots.txt file." "If it marks the URL as disallowed, then Googlebot skips making an HTTP request to this URL and skips the URL." And: "Google Search won't render JavaScript from blocked files or on blocked pages." If content only appears after JavaScript runs and that script was blocked, "If the content isn't visible in the rendered HTML, Google won't be able to index it" (Understand the JavaScript SEO basics).
Current Help wording: "If a blocked resource is important, it could have a big effect on how Google understands the page." For example, "a blocked CSS file could result in incorrect font styles being applied (for example, too small for a device)" (Rich Results Test).
Since 2014 Google has said that if JavaScript or CSS are blocked with robots.txt, "our indexing systems won't be able to see your site like an average user." And "We recommend allowing Googlebot to retrieve JavaScript and CSS so that your content can be indexed better" (Understanding web pages better). "Googlebot follows the robots.txt rules for all files that it fetches." Googlebot should reach resources that "meaningfully contributes to your site's visible content, or to its layout" (Rendering pages with Fetch as Google). That is not a claim that a blocked folder automatically costs rankings.
Google's own pattern: block a folder, but allow Googlebot the .css/.js
Google's specification shows a folder with files "as .css, .js, but Google needs them for rendering," so "Google needs them for rendering, so Googlebot is allowed" — Disallow: /includes/ for others, Allow: /includes/ for Googlebot (robots.txt specification).
Illustrative only (not from any real site):
```
Illustrative only — not from any real site
User-agent: * Disallow: /_next/ ```
AgencyReferee note (not a Google claim): framework sites such as Next.js often load CSS/JS under /_next/. That is a common path pattern — not a Google requirement to Allow: /_next/. Ask whether Googlebot should reach your rendering files.
"Only one group is valid for a particular crawler." Google picks "the group with the most specific user agent that matches the crawler's user agent. Other groups are ignored" (robots.txt specification). A User-agent: Googlebot group replaces * for Googlebot; it does not stack on top of it.
Your 10-minute public check
Steps 1–4 need no Search Console. Steps 5–6 are optional. Steps 2–4 are AgencyReferee house methods, not a Google procedure.
- Open
https://yourdomain/robots.txtin a private/incognito window (Google suggests a private window to test public access) (Create a robots.txt file). Note everyUser-agent:andDisallow:— watch for/_next/or/includes/. - Open your homepage → View page source or Inspect → Network (filter CSS/JS), or search
.css,.js,/_next/. Write down the folder prefixes your styles and scripts load from. - Compare: does a CSS/JS prefix fall under a
Disallow:that applies to Googlebot? Check for aUser-agent: Googlebotgroup first — if one exists, only that group applies (robots.txt specification). If the folder holding layout CSS and main JS is disallowed for Googlebot, flag a possible block of resources Google needs. - Repeat step 2 on Contact and one service page. If CSS/JS load from a CDN or other host, your main
/robots.txtdoes not cover them: "It's not valid for other subdomains, protocols, or port numbers" (robots.txt specification). Check that host's own/robots.txt. - (Optional, Search Console) URL Inspection → live test → screenshot and loaded resources. "You can view a screenshot of the rendered page as the Google-InspectionTool sees it." "Differences might be the result of resources that are blocked to the Google-InspectionTool" (URL Inspection tool). Access questions: Questions to ask your SEO agency.
- (Optional) Rich Results Test for rendered HTML / loaded resources (JavaScript SEO basics; Fix Search-related JavaScript problems). "You should make sure that important resources are not blocked to Google-InspectionTool by robots" (Rich Results Test). Do not assume the test works without sign-in.
After a rebuild or host move, re-open /robots.txt (Switch marketing agencies without losing rankings). Related view-source habit: Check Universal Analytics on your website.
Questions to send your developer or agency
Copy these into an email. They are AgencyReferee questions, not Google's.
- Who added
Disallow: /_next/(or the rule blocking our CSS/JS folder), and what was it meant to do? - Are our layout CSS and main JavaScript files inside that disallowed folder?
- If the folder must stay blocked for other bots, is there a Googlebot
Allow:like Google's own/includes/example? - Can you send a URL Inspection live-test screenshot and the loaded-resources list for our homepage?
- Which blocked files are non-critical (analytics, fonts, social) and safe to leave disallowed?
What you can't tell from outside
- From outside you cannot see how Google rendered or indexed your page. URL Inspection and Rich Results Test show a rendered view — tests, not a ranking report.
- A blocked folder does not prove lost rankings or de-indexing. Google's wording is harder to understand, and blocked JavaScript will not be rendered — not a penalty.
- A blocked URL can still be found and indexed as an address if linked elsewhere: "we might still find and index a disallowed URL if it is linked from other places on the web" (Introduction to robots.txt). This guide is about resources, not whole pages disappearing.
- Differences can also come from too many resources, server errors, or slow/large resources (Troubleshoot crawling and indexing errors). Robots is one reason, not the only one. Do not treat "outdated JavaScript or CSS resources" as a robots issue — that is caching, not Disallow.
If a broad Disallow covers the folder holding your layout CSS and main scripts, and nobody can explain why Googlebot should stay blocked, sort that out before treating rendered search views as settled.
Sources
- Introduction to robots.txt (developers.google.com)
- Create and submit a robots.txt file (developers.google.com)
- How Google interprets the robots.txt specification (developers.google.com)
- Robots Refresher: robots.txt — a flexible way to control how machines explore your website (developers.google.com)
- Troubleshoot crawling and indexing errors (developers.google.com)
- Rendering pages with Fetch as Google (developers.google.com)
- Understand the JavaScript SEO basics (developers.google.com)
- Rich Results Test - Search Console Help (support.google.com)
- Understanding web pages better (developers.google.com)
- URL Inspection tool (support.google.com)
- Fix Search-related JavaScript problems (developers.google.com)
Sources checked on November 5, 2026. Spot an error or an outdated link? Email james@agencyreferee.com and we’ll correct it.

