Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

A one-line robots.txt mistake made my site look broken to Google

I spent an afternoon debugging why my newly launched site rendered without styles in Google's crawler. The content was there. The CSS was not. The culprit was a single line in robots.txt that I had copied from an old pro

I spent an afternoon debugging why my newly launched site rendered without styles in Google's crawler. The content was there. The CSS was not. The culprit was a single line in robots.txt that I had copied from an old project without thinking.

The line was Disallow: /_astro/.

Why that line is a problem

Astro puts all compiled CSS and JavaScript under /_astro/. Modern search engines render pages with JavaScript, which means they need to fetch those assets to see the page the way a visitor does. Blocking the asset directory does not hide the assets from users — it hides them from the crawler doing the rendering.

The result is a page that looks unstyled and script-free to Google. It still gets indexed, but it looks like a broken 1998 page in the rendered view.

The fix

Remove the rule. Static CSS and JS cost you nothing in crawl budget and should always be fetchable. The only things worth disallowing are things you genuinely do not want indexed: admin areas, search result pages, duplicate parameter URLs.

There is a broader lesson here. A lot of "SEO best practices" floating around are about not being crawled, inherited from an era when crawl budget mattered for huge sites. For a small static site, the opposite is true: let everything be crawled. Your problem is discoverability, not over-crawling.

How I caught it

I used the URL Inspection tool in Google Search Console and looked at the rendered screenshot. Comparing that against a normal browser view made the missing styles obvious. If you only look at the HTML tab, you will never see it — the HTML was fine. The rendered view is the ground truth.

Check your robots.txt. It is the highest-leverage file on a small site.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.