The automatic sitemap for my Django site fluctuates between including the www on urls and leaving it out (I'm aiming to have it in all the time). This has ramifications in google not indexing my pages properly so I'm trying to narrow down what would be causing this issue.
I have set PREPEND_WWW = True and my site record in the sites framework is set to include the www e.g. it's set to www.example.com as opposed to example.com. I'm using memcached but pages should expire from the cache after 48 hours so I wouldn't have thought that would be causing the issue?
You can see the problem in effect at http://www.livingspaceltd.co.uk/sitemap.xml (refresh the page a few times).
My sitemaps setup is fairly prosaic so I'm doubtful that that is the issue, but in case it's something obvious I'm missing here's the code:
***urls.py***
sitemaps = {
'subpages': Subpages_Sitemap,
'standalone_pages': Standalone_Sitemap,
'categories': Categories_Sitemap,
}
urlpatterns = patterns('',
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
...
***sitemaps.py***
# -*- coding: utf-8 -*-
from django_ls.livingspace.models import Page, Category, Standalone_Page, Subpage
from django.contrib.sitemaps import Sitemap
class Subpages_Sitemap(Sitemap):
changefreq = "monthly"
priority = 0.4
def items(self):
return Subpage.objects.filter(restricted_to__isnull=True)
class Standalone_Sitemap(Sitemap):
changefreq = "weekly"
priority = 1
def items(self):
return Standalone_Page.objects.all()
class Categories_Sitemap(Sitemap):
changefreq = "weekly"
priority = 0.7
def items(self):
return Category.objects.all()