A lot of bilingual small business sites put both languages in the same HTML file and hide one with CSS or a JavaScript toggle. Visitors see one language. Googlebot sees both on every URL. Google detects language from the visible text, so a half-English, half-Spanish page confuses it, and hreflang is impossible because there's only one URL.
The fix is one language per URL: English at / , Spanish at /es/ , and hreflang tags linking each pair. Everything below was tested on Astro 7.4 with @astrojs/sitemap 3.7.
1. Check whether you have the problem
Open View Source on any English page and search for a Spanish word from your copy. If it's there, or the language switcher only changes a cookie or localStorage value while the URL stays the same, you need this refactor.
2.…