#26073: Last-Modified http header not set to the latest last-mod in multi-maps
sitemaps
------------------------------+--------------------------------------------
Reporter: xblitz | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.9
contrib.sitemaps |
Severity: Normal | Keywords: sitemap last-mod Last-Modified
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------------
at
[https://github.com/django/django/blob/master/django/contrib/sitemaps/views.py#L46]
{{{
def sitemap(request, sitemaps, section=None,
template_name='sitemap.xml', content_type='application/xml'):
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.af2281aab2027059deaf485d4d9fd7c7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.