-
Notifications
You must be signed in to change notification settings - Fork 157
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 ] Using 'links' option in an entry breaks sitemap generation #397
Comments
the same for me... |
bump |
same for me |
@martinsilha can you show me your |
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 sitemap.js/lib/sitemap-stream.ts Line 38 in 815680c
http to https . Problem seems to be gone now.
|
Thanks for the comment above. This fixed the issue: const sitemapXml = (await streamToPromise(smStream)).toString();
// Thanks to this comment:
// https://github.com/ekalinin/sitemap.js/issues/397#issuecomment-1438062056
const sitemapXmlHttps = sitemapXml.replace(
new RegExp('http://', 'g'),
'https://',
); |
Ok, when we say "fails validation" I think people are simply talking about browsers rendering of XML right? Questions
Note that all the Google docs for sitemaps still show all the https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap |
right, if you change the xmlns attribute to https it will fail validation by the google crawler (at least as of a couple years ago). xmlns looks like a link but is in fact just a specification token. You can go to that in the browser and it will probably redirect you to https but when this was changed several years ago google would flag it as an invalid sitemap. And yeah gonna need more info on what "fails validation" is. |
@derduher, I feel like this is not a bug; you are both correct. The only problem is browser XML rendering, but the sitemap itself is entirely correct. This rendering issue also confused me, but it is a valid sitemap. |
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:
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:
Additional context
I am currently generating the sitemap with the 'Serve a sitemap from a server and periodically update it' example from this package.
The text was updated successfully, but these errors were encountered: