I have this in my django project.
In views.py
:
class MediatorViewSitemap(Sitemap):
changefreq = 'monthly'
priority = 0.8
def items(self):
return Mediator.objects.exclude(photo='')
def lastmod(self, obj):
return obj.modified
static_list =[
'home',
'mediators_list',
'about',
'faq',
'pricing',
'terms',
'privacy',
'contact',
]
class StaticViewSitemap(Sitemap):
priority = 0.5
changefreq = 'daily'
def items(self):
return static_list
def location(self, item):
return reverse(item)
And this in my urls.py
sitemaps = {
'mediators': MediatorViewSitemap,
'static': StaticViewSitemap
}
url(
r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
name='django.contrib.sitemaps.views.sitemap'
),
And it generate very well my sitemap.xml
Now I have integrated djangocms to my django project, so I have this url in the same urls.py
:
url(r'^blog/', include('cms.urls')),
What I want is to add it to the same sitemap.xml
, any suggestion of any tutorial or help from anyone ?
Import the
CMSSitemap
likefrom cms.sitemaps import CMSSitemap
then mix that with yourSitemap
classes;There is a package to extend sitemaps from one of the CMS core dev team as well that may be of use to you; https://github.com/nephila/djangocms-page-sitemap/