Django Sitemap issue: GSC fail to fetch sitemap with error "Sitemap could not be read"

I created sitemap using django default sitemap

from django.contrib.sitemaps.views import sitemap

Here is the complete process

#urls.py

sitemaps = {
'static': StaticViewSitemap,
'blogpost_detail': BlogSitemap,
'portfolio-details': PortfolioSitemap,
# Add others like 'posts': PostSitemap if needed

}

path(
    "sitemap.xml", sitemap, {"sitemaps": sitemaps}, name="django.contrib.sitemaps.views.sitemap")

I can access sitemap at https://dataguru.cc/sitemap.xml but upon submission i get "Sitemap could not be read",

I have tried these few things so far

  1. Reduced the size of sitemap to single link to verify
  2. Added rule in cloudflare to bypass compression and cache for /sitemap.xml
  3. since its created by django but still verified syntex of xml using online tools
  4. Used static sitemap.xml from template view
  5. changed the name from sitemap.xml to site_map.xml

So far nothing is working so i would appreciate any help, if it has something to do with my django app or something else..

Additionally i have a middleware that doesn't interfere with requests but i have disabled it and result is just the same.

Google Search provides a tool that allows you to check the sitemap you’ve generated with Django (e.g., example.com/sitemap.xml). Please check your url.py settings against the docu.

It seems that the extract you provided doesn’t resemble a proper sitemap.xml file. Please double-check the actual file at that URL endpoint.

Note: The sitemap is not directly accessible unless you know the correct steps to access it.

To proceed, please save the sitemap.xml file and submit it via the Google Search Console. This will help you identify and debug any issues with your sitemap.

You can find an explanation of how sitemap submissions work here:

🔗 Google Webmaster Help – About sitemaps

And you can test and submit your sitemap here:

🔗 Google Search Console – Sitemap Test Page

Please let me know if you need assistance with retrieving or submitting the sitemap.

Вернуться на верх