ekalinin/sitemap.js

[ BUG ] Using 'links' option in an entry breaks sitemap generation

martinsilha opened this issue ยท 10 comments

Describe the bug
When adding the 'links' option to a sitemap entry that is already working, it is causing sitemap creation to fail validation. From the 'Options you can pass' example:

links: [
    { lang: 'en', url: 'http://test.com/page-1/' },
    { lang: 'ja', url: 'http://test.com/page-1/ja/' }
  ],

Expected behavior
I expected the sitemap to add the <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en" href="https://url.example" /> entry to the sitemap, which it does. The problem is that the entire sheet fails validation after doing so.

Context:

  • Library Version 7.1.1

Additional context
I am currently generating the sitemap with the 'Serve a sitemap from a server and periodically update it' example from this package.

duxor commented

the same for me...

same for me node 16.17.0

@martinsilha can you show me your sitemap example ? And how does it fail ? Are you not seeing the proper layout in the browser when navigating to sitemap ?

same here, if I add links I don't get xml anymore but just a string with link sequences without structure

same for me.

@martinsilha PS: I had to fix this manually by editing all the links starting here

if (news) {
from http to https. Problem seems to be gone now.