Menu

A one-line robots.txt mistake made my site look broken to Google
πŸ“°

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

DEV Community: astroΒ·Ayu GTA6Β·6 days ago
#HB6ICiQB
#devtoastro#devto#dev#rendered#google
Long article (296 words) β€” no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.