I am struggling to get the "alternates" attribute to work in the Django sitemap framework.
class StaticViewSitemap(sitemaps.Sitemap):
priority = 0.5
changefreq = 'daily'
i18n = True
alternates = True
def items(self):
return ['index', 'about']
def location(self, item):
return reverse(item)
The documentation appears to suggest the above i.e. setting i18n and alternates to True. But when I do that, my sitemap is literally a plain test string like this:
Whereas it should look like so:
<urlset xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9" xmlns: xhtml = "http://www.w3.org/1999/xhtml" >
<url >
<loc > http: // 127.0.0.1: 8000/</loc >
<changefreq > daily < /changefreq >
<priority > 0.5 < /priority >
</url >
<url >
<loc > http: // 127.0.0.1: 8000/about/</loc >
<changefreq > daily < /changefreq >
<priority > 0.5 < /priority >
</url >
</urlset >
There are two issues:
- It doesn't have the correct formatting. What am I doing wrong here?
- I don't want the 'en' language prefix for the default language. How do I remove this?