Opened 2 years ago

Closed 2 years ago

#33621 closed Bug (invalid)

Remove "alternate" and change "schema" in sitemaps.

Reported by: Maxim Danilov Owned by: nobody
Component: contrib.sitemaps Version: 4.0
Severity: Normal Keywords: sitemap.xml
Cc: Florian Demmer Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

default sitemap.xml
in case if i have multilanguage sitemap with:

<xhtml:link rel="alternate" hreflang="en" href="something_en" />
<xhtml:link rel="alternate" hreflang="de" href="something_de" />

Browser shows plain text. For example, google sitemap.xml "https://www.google.com/nonprofits/sitemap.xml".
https://habrastorage.org/webt/1f/jz/ii/1fjziijky8a0ptaolhrrzvcjx8c.png

Without rel="alternate" all is human-readable.
https://habrastorage.org/webt/bq/up/hq/bquphqekr3lvcxy2bxu_fllicye.png

It happens only if i have rel="alternate".

I found, that we should update in django.contrib.sitemaps\templates\sitemap.xml

xmlns:xhtml="http://www.w3.org/1999/xhtml"

to

xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html"

I found the similar issue https://code.djangoproject.com/ticket/33117, but there probably was wrong idea, about "invalid xml"

Change History (1)

comment:1 by Mariusz Felisiak, 2 years ago

Cc: Florian Demmer added
Has patch: unset
Resolution: invalid
Status: newclosed
Summary: update in sitemap.xml the "xmlns:xhtml" shema.Remove "alternate" and change "schema" in sitemaps.

alternate is required for sitemaps that specify alternate language pages. As far as I'm aware the current implementation is in line with the Google guidelines. Moreover sitemaps doesn't need to be human-readable.

Note: See TracTickets for help on using tickets.
Back to Top