Making django sitemaps work with google

169 views Asked by At

One issue I get is that I suspect the content_type is incorrect for Google to see the sitemaps.xml correctly - it highlights the issue with:

Your Sitemap appears to be an HTML page. Please use a supported sitemap format instead.

So, I suspect I need to change the content type. I'm seeing some odd ways of doing this, everything using lambdas and HttpResponse solutions. With a url as follows, is there an easy way of changing the content_type to 'text/plain' or 'text/xml' for example?

The following does not work:

url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps, content_type='plain/xml'}, name='sitemap')

sitemaps = {'views': ViewSitemap}

where ViewSiteMap is my class that returns static urls. What is a smarter way of doing this?

0

There are 0 answers