mirror of https://github.com/django/django.git
Added comments to contrib.sitemaps.index() view.
This commit is contained in:
parent
c3e638112d
commit
8c45b5b903
|
@ -27,14 +27,17 @@ def index(request, sitemaps,
|
|||
req_protocol = request.scheme
|
||||
req_site = get_current_site(request)
|
||||
|
||||
sites = []
|
||||
sites = [] # all sections' sitemap URLs
|
||||
for section, site in sitemaps.items():
|
||||
# For each section label, add links of all pages of its sitemap
|
||||
# (usually generated by the `sitemap` view).
|
||||
if callable(site):
|
||||
site = site()
|
||||
protocol = req_protocol if site.protocol is None else site.protocol
|
||||
sitemap_url = reverse(sitemap_url_name, kwargs={'section': section})
|
||||
absolute_url = '%s://%s%s' % (protocol, req_site.domain, sitemap_url)
|
||||
sites.append(absolute_url)
|
||||
# Add links to all pages of the sitemap.
|
||||
for page in range(2, site.paginator.num_pages + 1):
|
||||
sites.append('%s?p=%s' % (absolute_url, page))
|
||||
|
||||
|
|
Loading…
Reference in New Issue