+def sitemap_section_index(request, section, sitemaps):
+ try:
+ sitemap = sitemaps[section]()
+ except KeyError:
+ raise Http404("Sitemap doesn't exist")
+
+ paginator = sitemap.paginator
+
+ locations = []
+
+ for page in paginator.page_range:
+ location = urlresolvers.reverse('sitemap_section_page', kwargs={ 'page' : page, 'section' : section })
+ location = '%s%s' % (settings.APP_URL, location)
+ location = re.sub("/+", "/", location)
+ location = location.replace('http:/', 'http://')
+ location = location.replace('https:/', 'https://')
+ locations.append(location)
+
+ xml = loader.render_to_string('sitemap_section_index.xml', { 'locations' : locations, })
+ return HttpResponse(xml, mimetype='application/xml')
+
+def sitemap(request, sitemaps, section=None, page=1):