-
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]: Sub path is stripped from siteUrl in sitemap-index.xml #32080
Comments
So my guess is this is happening because the siteUrl is expected to be a domain. |
I could be wrong here but that's always been my assumption. Given I wrote the sitemap plugin this is probably why that's getting stripped, cause I expected it to be a domain. It's been a while but I believe if you are using the pathPrefix functionality the sitemap plugin will correctly append that in the sitemap. If not we can fix that. |
Thing is, that doesn't work either:
->
The path in the output is still |
Reproduction branch here: https://github.com/prichey/sitemap-bug/tree/path-prefix. Thanks for the quick response! |
Good to know!! Looks like this was missed. I'll fix this if I have time but I work on Gatsby for fun so I don't have a timeline. Anyone who wants to tackle this please do so. |
It's possible this will fix your issue, as it changes to using |
Okay, I checked out your repro and this is working as expected. you need to use Gatsby's path prefix functionality. If you gatsby config is: module.exports = {
/* Your site config here */
pathPrefix: '/foo',
siteMetadata: {
siteUrl: 'https://mysite.com/',
},
plugins: ['gatsby-plugin-sitemap'],
} then you use the command #32107 will make sure that the asset prefix isn't also appended and will fix a different bug. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
Description
My
siteUrl
is mangled in thesitemap.xml
. In this example, thesiteUrl
ishttps://mysite.com/foo
but the location insitemap-index.xml
ishttps://mysite.com/sitemap/sitemap-0.xml
(rather thanhttps://mysite.com/foo/sitemap/sitemap-0.xml
).gatsby-config.js
:Steps to reproduce
npm run build
Expected result
public/sitemap/sitemap-index.xml
:Actual result
public/sitemap/sitemap-index.xml
:Environment
Reproduction repo: https://github.com/prichey/sitemap-bug
The text was updated successfully, but these errors were encountered: