Sitemaps - multiple locations per object

58 views
Skip to first unread message

PRyan

unread,
Sep 17, 2014, 7:50:13 PM9/17/14
to django...@googlegroups.com
Hello,
I have business objects which have multiple urls each. The sitemap for the business objects them self work and I get the following:
/store/<object_id>

However, each business has sites specific to it. So I need sitemaps to create:
/store/<object_id>
/store/<object_id>/contact
/store/<object_id>/about

Is there a way I can get Sitemaps to go through the urls.py of that app, or tell it the locations I want per object?

Thanks!

Collin Anderson

unread,
Sep 19, 2014, 6:40:39 PM9/19/14
to django...@googlegroups.com
Something like this might work:

class MySitemap(sitemaps.Sitemap):
   
def items(self):
        urls
= []
       
for obj in Store.objects.all():
            urls
.append((obj, ''))
            urls
.append((obj, 'about'))
            urls
.append((obj, 'contact'))
       
return urls

   
def location(self, info):
       
return '/store/%s/%s/' % info[0], info[1]




Pierre de Nomazy

unread,
Sep 23, 2014, 5:28:56 AM9/23/14
to django...@googlegroups.com
Thanks
Reply all
Reply to author
Forward
0 new messages