Visitar URL original
[ BUG ] missing namespace when adding (locallized) linkItems · Issue #364 · ekalinin/sitemap.js · GitHub
Skip to content

[ BUG ] missing namespace when adding (locallized) linkItems #364

Open

Description

@flowen

Describe the bug
I'm using the gatsby-plugin-sitemap package and generate a sitemap with localized links.
The <xhtml:link> namespace is not recognized by the default namespace tag on <urlset>.
When doing so, the sitemap is not readable as XML and read as XHTML by the browser.

Also, see this and this issue. Which show the answer as:

<urlset
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
                      http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
                      http://www.w3.org/TR/xhtml11/xhtml11_schema.html
                      http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
  xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html"
  xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">

(I've added news/mobile/image/video to the answer)
I'm getting these errors when validating here, whether I use the above answer or the general output (with added linkItems):
Error 1845: Element '{http://www.w3.org/TR/xhtml11/xhtml11_schema.html}link': No matching global element declaration available, but demanded by the strict wildcard.

I'm by far no XML expert and cannot confirm which is correct.
But using the above answer, the sitemap.xml is at least read by the browser as XML.

Expected behavior
When adding linkItems the correct namespace should be added and above errors should not occur.

Context:

  • gatsby-plugin-sitemap@2.12 (I'm using an older version because of Gatsby v2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions