1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Refs #27395 -- Added XML namespace declaration to sitemap template.

As per Google recommendations:
https://support.google.com/webmasters/answer/189077?hl=en
This commit is contained in:
Carlton Gibson
2020-07-29 10:30:55 +02:00
committed by Carlton Gibson
parent 948a874425
commit 50e1ccbbea
4 changed files with 10 additions and 10 deletions

View File

@@ -40,7 +40,7 @@ class GenericViewsSitemapTests(SitemapTestsBase):
for pk in TestModel.objects.values_list("id", flat=True):
expected += "<url><loc>%s/testmodel/%s/</loc></url>" % (self.base_url, pk)
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
%s
</urlset>
""" % expected
@@ -51,7 +51,7 @@ class GenericViewsSitemapTests(SitemapTestsBase):
TestModel.objects.update(lastmod=datetime(2013, 3, 13, 10, 0, 0))
response = self.client.get('/generic-lastmod/sitemap.xml')
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url><loc>%s/testmodel/%s/</loc><lastmod>2013-03-13</lastmod></url>
</urlset>
""" % (self.base_url, test_model.pk)