Friday, September 19, 2014

Re: Sitemaps - multiple locations per object

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]




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ec8449c-5893-468f-982f-1f25454fc1e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment