-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Sitemap sometimes not generated correctly #10171
Comments
cc @ematipico |
It's definitely a regression of the latest changes, we'll have to debug them |
Do you know if there is any difference between I have run the test about 30 times locally and this does not happen. but by I have also checked that if I hardcode an incorrect structure and run the test, the test will fail. Like: it('Index file load correct sitemap', async () => {
const data = await readXML('<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>http://example.com/sitemap-0.xml</loc></sitemap>');
const sitemapUrl = data.sitemapindex.sitemap[0].loc[0];
assert.strictEqual(sitemapUrl, 'http://example.com/sitemap-0.xml');
const prefixData = await readXML(fixture.readFile(`/${prefix}index.xml`));
const prefixSitemapUrl = prefixData.sitemapindex.sitemap[0].loc[0];
assert.strictEqual(prefixSitemapUrl, `http://example.com/${prefix}0.xml`);
}); then,
|
Is there a function that is called after After some debugging, I think It is possibly due to something other than sitemap integration. (Not sure) Throwing an error after runCommand for debugging, It seems that the sitemap structure is always correct. export async function cli(args: string[]) {
const flags = yargs(args, { boolean: ['global'], alias: { g: 'global' } });
const cmd = resolveCommand(flags);
try {
await runCommand(cmd, flags);
+ throw new Error('Just testing...');
} catch (err) {
const { throwAndExit } = await import('./throw-and-exit.js');
await throwAndExit(cmd, err);
}
} |
Also seeing this problem as of @astrojs/sitemap 3.1.0. I'm getting this output in <?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.fisherfrontier.com/sitemap-0.xml</loc>
</sitemap>
Per Google Search Central, should include closing tag <?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.fisherfrontier.com/sitemap-0.xml</loc>
</sitemap>
</sitemapindex> |
This is the same thing I am saying. |
I'd suggest reverting the PR if we cannot figure out a fix quickly. |
Currently I have no idea how to fix so I agree with that. sorry |
Absolutely no worries! It happens, you couldn't have known. |
I'll have a look in a few hours |
It seems to be an issue related to stream, and I'll be honest, I don't know how to fix it. It's really weird that this library doesn't allow to change the file name. Only way possible is by using streams... We should revert the PR. |
Thank you. Fortunately for me, I am deploying manually now using but I will try again when I have more time to see if there is a way to fix. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
After #9846, sometimes the structure is incorrect when generating the sitemap. (even not set
prefix
)but
${pefix}-0.xml
is always the correct structure.sitemap.mov
What's the expected result?
Always generated with the correct structure
Link to Minimal Reproducible Example
N/A
Participation
The text was updated successfully, but these errors were encountered: