-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby-plugin-sitemap always generates sitemap-index even on low page count #31282
Comments
I don't know if this was done on purpose @moonmeister? We now use gatsby/packages/gatsby-plugin-sitemap/src/gatsby-node.js Lines 88 to 95 in ea81d3b
So the behavior changed and thus it's currently working as intended but the docs then might be outdated if |
Yeah the index file always exists. Good catch, a PR would be much appreciated to clarify this language. |
I think that it's somewhat of an overkill to always generate index in case you might have over 50,000 entries. For a lot of gatsby projects out there previous behavior which resulted in a single sitemap.xml looked way more sensible. |
Yeah, It may be a little "cleaner", but at the end of the day I couldn't think why it really mattered. The bots don't care. The reason it changed was because the default behavior of the library we use changed. I wasn't going to spend hours rewriting code to fix it. If this is important to you, feel free to do the work and submit a PR. |
One more bug though: generated index file is containing wrong URLs to individual files: <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://abheist.com/sitemap-0.xml</loc>
</sitemap>
</sitemapindex>
|
This has been reported and fixed in the next release. |
Perfect, thanks! |
What's the news? |
Related to this, the
The 4. release seems to have lots of issues so I'm going to try downgrading until these are worked out |
@prichey Please open a separate issue for this and a reproduction or more detailed example of your configuration. and what is happening vs what you expect to happen. |
You mention that "the bots don't care." However, after doing some research, it seems that having the sitemap in a subfolder will only allow google to scan pages in that subfolder. Here's a reference to this: Stackoverflow answer with link to google docs Could you please explain if this is incorrect? |
I have multi domains and work with Gatsby 2, but since I move for Gatsby 4 my sitemap is like this : https://inte.****.fr/https://inte.****.it/intimo-premaman Could you help me please. |
Hi @Pandanaax ! Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you open a new issue. Please include a minimal reproduction and a copy of any relevant code/config or a link to the repository. Thanks for using Gatsby! 💜 |
Description
According to documentation
gatsby-plugin-sitemap
should only generate sitemap-index when having more entries thanentryLimit
optionWith recent updates (
4.0
) this is not the case anymore.sitemap-index.xml
is always generated, which is quite weird for small amount of entries. It is a different problem than the one being solved currently in #31167, but it existence seems related to recent activity.Steps to reproduce
Branch with reproducible case: https://github.com/ichik/ichik.xyz/tree/sitemap-bug
Expected result
Link to
sitemap.xml
generatedActual result
Link to
sitemap-index.xml
generatedEnvironment
The text was updated successfully, but these errors were encountered: