Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
flowen opened this issue Jun 22, 2021 · 0 comments
Open

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

flowen opened this issue Jun 22, 2021 · 0 comments

Comments

@flowen
Copy link

flowen commented Jun 22, 2021

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
Projects
None yet
Development

No branches or pull requests

1 participant