-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
Our Gatsby site is served from the same domain as some other sites, so I'm setting assetPrefix option to a relative path (/assets/blog) to allow our main nginx server that handles the whole domain to proxy everything that starts with /assets/blog to this site.
The problem is that when I build this site with --prefix-paths option (gatsby build --prefix-paths) gatsby-plugin-sitemap adds assetPrefix every URL in the generated sitemap files.
Additionally, prefixing every page path with assetPath happens outside of any function that I can overwrite.
Reproduction Link
https://github.com/szimek/gatsby-sitemap-asset-prefix-issue
Steps to Reproduce
- Run
npm run build. - Open the generated
public/sitemap/sitemap-0.xmlfile. - You'll see that the generated urls have
/assetsprefix, e.g.https://gatsbystarterdefaultsource.gatsbyjs.io/assets/using-dsg.
Expected Result
Urls in the generated sitemap files do not have assetPrefix added, i.e. rather than https://gatsbystarterdefaultsource.gatsbyjs.io/assets/using-dsg I'd expect the url to be https://gatsbystarterdefaultsource.gatsbyjs.io/using-dsg.
Actual Result
Urls in the generated sitemap files do have assetPrefix added, e.g. https://gatsbystarterdefaultsource.gatsbyjs.io/assets/using-dsg.
Environment
System:
OS: macOS 11.6.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - /var/folders/3l/fqdyl_w91c71153myktd2r3w0000gn/T/yarn--16371
64001518-0.8952226837346255/node
Yarn: 1.22.17 - /var/folders/3l/fqdyl_w91c71153myktd2r3w0000gn/T/yarn--16371
64001518-0.8952226837346255/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 95.0.4638.69
Firefox: 91.0.2
Safari: 15.1
npmPackages:
gatsby: ^4.2.0 => 4.2.0
gatsby-plugin-gatsby-cloud: ^4.2.0 => 4.2.0
gatsby-plugin-image: ^2.2.0 => 2.2.0
gatsby-plugin-manifest: ^4.2.0 => 4.2.0
gatsby-plugin-offline: ^5.2.0 => 5.2.0
gatsby-plugin-react-helmet: ^5.2.0 => 5.2.0
gatsby-plugin-sharp: ^4.2.0 => 4.2.0
gatsby-plugin-sitemap: ^5.2.0 => 5.2.0
gatsby-source-filesystem: ^4.2.0 => 4.2.0
gatsby-transformer-sharp: ^4.2.0 => 4.2.0
Done in 2.64s.Config Flags
No response