It’s frustrating when your sitemap isn’t working in Google Search Console for your GitHub Pages site. Here’s a breakdown of common reasons and how to troubleshoot them:
Common Reasons for “Couldn’t Fetch” Error:
https://
and any trailing slashes if necessary. It should point directly to your sitemap.xml
file on your GitHub Pages site.sitemap.xml
(case-sensitive on some systems).sitemap.xml
file should ideally be located in the root directory of your GitHub Pages repository.yourusername.github.io/sitemap.xml
or yourdomain.com/sitemap.xml
if using a custom domain)..nojekyll
file in your repository (used to bypass Jekyll processing), it might inadvertently prevent Googlebot from accessing your sitemap if it’s in a Jekyll-specific directory (though this is less likely if you’ve manually created the sitemap.xml
). Try temporarily removing it to see if it resolves the issue (and add it back if it doesn’t).<urlset>
, <url>
, <loc>
, etc.).robots.txt
file (if you have one) to ensure it’s not accidentally disallowing access to your sitemap.xml
file for Googlebot. It should either explicitly allow it or not mention it at all. A common correct entry would be:
Sitemap: https://yourusername.github.io/sitemap.xml
Troubleshooting Steps:
sitemap.xml
URL. This can give you more specific information about whether Googlebot can access the file and any errors encountered. Look at the “Page fetch” status.robots.txt
File: Ensure your robots.txt
file (if present) isn’t blocking the sitemap.Specific Considerations for GitHub Pages:
sitemap.xml
as a static file during your build process.By systematically checking these potential issues, you should be able to identify why Google Search Console can’t fetch your sitemap on GitHub Pages and get it working correctly.