24 October 2026
CSS and JavaScript blocked in robots.txt
When robots.txt blocks CSS or JavaScript, Googlebot still crawls the page but renders a bare version without layout, menus, or a reliable LCP.
What Disallow on CSS and JS actually blocks
Robots.txt decides whether a crawler may fetch a URL, not whether that URL may be indexed. If you set Disallow: /css/ or Disallow: /js/, Googlebot will not download those files. The HTML document is often still allowed. Googlebot therefore receives the markup but misses the stylesheets and scripts that produce layout, navigation, and interactive content. The rendered page in Search Console then looks like a bare document tree: text without columns, menus that never open, and buttons that do nothing.
That is different from disallowing the page URL itself. Block the document and the crawler never enters. Block only the assets and the crawler still fetches the URL, then renders an incomplete version. Links injected into the DOM by JavaScript never appear. Images loaded through CSS or lazy-load scripts stay invisible. The Largest Contentful Paint you measure in a browser is not the LCP Googlebot records, because the hero element you care about never materializes when CSS or JS is blocked.
Why the mistake keeps returning
Old security checklists sometimes told teams to disallow everything under /assets/ or /static/ "for bots". That does not protect sensitive data: CSS and JS are public to every browser. It only stops Googlebot from building a usable render. CDN paths, hashed filenames, and separate asset hosts make the damage wider: one broad Disallow on /wp-content/, /_next/, or /cdn/ can cut off every stylesheet and bundle at once.
Check the rendered screenshot in the URL Inspection tool, not only the HTTP status of the document URL. If the layout is empty or collapsed, search robots.txt for rules on .css, .js, /assets, or your bundle directory. Remove those rules for public files. Keep Disallow for real closed zones such as staging, admin, and private APIs. Structural crawl checks in a technical SEO scan can surface blocked resources without opening every asset by hand.
A single blocked stylesheet can hide internal links inside a hamburger menu. A single blocked hydration script can hide filters or pagination from Googlebot while human visitors still see everything. That gap between the browser view and the crawler render is the trap: rankings look unstable when the root cause is an overly strict robots.txt.
Frequently asked questions
Yes, for public pages those files must be crawlable. Do not Disallow them in robots.txt if you want Googlebot to render the page correctly.
Yes. Disallow on the page keeps the crawler out. Disallow on assets still fetches the HTML but drops styles, scripts, links, and layout.
Use URL Inspection for the rendered screenshot and blocked-resource list. An empty or collapsed layout often points to robots.txt rules on CSS or JS.
Want this on your site today?
First report free. Then auto-scan, a PDF in your inbox and alerts when a score drops.
Start a free report