Hi everyone, I’m pretty new to Hugo and GitHub Pages, and I’ve built my site here: https://2mata.github.io. using Hugo (static site generator).
I generated sitemap.xml (and feed.xml) using Hugo’s default setup. The files appear fine when I open them in the browser (e.g. https://2mata.github.io/sitemap.xml),but when I try to submit them in Google Search Console, I get this message: “Couldn’t fetch” → “Sitemap could not be read”.
I’m not sure what’s wrong — I’m hoping someone here can point me:
Could this be because of incorrect base URL or configuration in Hugo? (I used the default config.)
Do I need to add a robots.txt in the root and explicitly list the sitemap location?
Are there any known issues when using Hugo + GitHub Pages + Search Console together?
What steps should I check (permissions, URL correctness, XML validity, headers, hosting setup) to fix this?
I’m a beginner, so very detailed / step-by-step explanation will be much appreciated.
Welcome.
This is common with new sites. “Couldn’t fetch” in Google Search Console often doesn’t actually mean it failed, but often means “Pending” or “I timed out, I’ll try again later.”
Your sitemap returns a 200 OK status and is valid XML, your robots.txt is also valid, the problem is on Google’s end, not your Hugo setup.
In the Google Search Console do:
URL Inspection for your exact URL that you entered in the Sitemap field,
Ignore the URL is not on Google warning and press the TEST LIVE URL button.
If you get “URL is available to Google” and green checkmarks, the “Couldn’t fetch” error on the Sitemaps tab is just a false negative.
Don’t touch anything, wait 24-48 hours and it will resolve.
It’s not a Hugo issue, but a Github issue. For some reasons sometimes Google is blocked from accessing *.github.io site’s sitemap - without regards to the producer if the file. There is no official workaround and you won’t find them acknowledging this issue. I wonder if it maybe is some form of configuration about too many requests from Google’s bot.
You could probably use a service like Cloudflare to have the sitemap deliver via cache to get around this. Or use a different service like Netlify or Cloudflare pages for your site. Both have free options that might even be better, if you care about Google being happy.