how to add cms.urls integrated in my django application to sitemap.xml

8 views
Skip to first unread message

GAFSI Omar

unread,
Oct 6, 2017, 12:34:02 PM10/6/17
to Django users

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 ?

Reply all
Reply to author
Forward
0 new messages