req_protocol = request.scheme
req_site = get_current_site(request)
if section is not None:
if section not in sitemaps:
raise Http404("No sitemap available for section: %r" %
section)
maps = [sitemaps[section]]
else:
maps = sitemaps.values()
page = request.GET.get("p", 1)
urls = []
for site in maps:
try:
if callable(site):
site = site()
urls.extend(site.get_urls(page=page, site=req_site,
protocol=req_protocol))
except EmptyPage:
raise Http404("Page %s empty" % page)
except PageNotAnInteger:
raise Http404("No page '%s'" % page)
response = TemplateResponse(request, template_name, {'urlset': urls},
content_type=content_type)
if hasattr(site, 'latest_lastmod'):
# if latest_lastmod is defined for site, set header so as
# ConditionalGetMiddleware is able to send 304 NOT MODIFIED
lastmod = site.latest_lastmod
response['Last-Modified'] = http_date(
timegm(
lastmod.utctimetuple() if isinstance(lastmod,
datetime.datetime)
else lastmod.timetuple()
)
)
return response
}}}
we can see that when it gets the ''''latest_lastmod'''' from '''site''' it
only really depends on which was the last '''site''' in '''maps''' which
might not always be the latest_lastmod from all items in maps.
I think this is a big SEO issue for websites that rely on their sitemaps
being indexed by search engines as I noticed my website did not seem to
have my newer Urls indexed by google since it probably saw the '''Last-
Modified''' http header was not being newer that what they currently had
(even if it contains new urls with newer last-mod)
--
Ticket URL: <https://code.djangoproject.com/ticket/26073>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* owner: nobody => xblitz
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
I will first make a test-case in a pull
--
Ticket URL: <https://code.djangoproject.com/ticket/26073#comment:1>
* status: assigned => closed
* resolution: => duplicate
Comment:
Duplicate of #25989 which already has a patch. Feel free to review it
using the PatchReviewChecklist and mark the ticket "Ready for checkin"
when it looks good.
--
Ticket URL: <https://code.djangoproject.com/ticket/26073#comment:2>