page-robots-sitemap

robots.txt: my new Sitemap line got glued onto the old one

Grabzies Ecommerce · 23 September 2026 · 3 replies
I added two new sitemaps to robots.txt with echo "Sitemap: ..." >> robots.txt. Now the file shows:

Sitemap: https://example.com/sitemap.xmlSitemap: https://example.com/sitemap-images.xml

on one line, with the second new sitemap on the next line. What happened?
3 Replies
John Carlsson · 23 Sept 2026
Your robots.txt didn't end with a newline. Appending adds text straight after the last character, so the first new line joined the last existing one. Google now reads one broken address instead of two good ones, so neither of those sitemaps is discovered through robots.txt.

Split it back onto two lines and make sure the file ends with a newline.
Grabzies Ecommerce · 23 Sept 2026
Fixed with sed and all three Sitemap lines show separately now. How do I avoid it next time?
John Carlsson · 23 Sept 2026
Before appending, check the last character and add a newline if it's missing:

tail -c1 robots.txt | od -c

If that doesn't show \n, run echo >> robots.txt first. Also check with curl after any edit, since that shows exactly what crawlers receive. Our audit tools include a robots.txt and sitemap checker.

Join the discussion

Sign in to reply, share your SEO experience and connect with other members.