Skip to content
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

@astrojs/sitemap: generate wrong link #9701

Closed
1 task
BeanWei opened this issue Jan 15, 2024 · 2 comments · Fixed by #9704
Closed
1 task

@astrojs/sitemap: generate wrong link #9701

BeanWei opened this issue Jan 15, 2024 · 2 comments · Fixed by #9704
Labels
needs triage Issue needs to be triaged

Comments

@BeanWei
Copy link

BeanWei commented Jan 15, 2024

Astro Info

Astro                    v4.1.2
Node                     v18.18.0
System                   Linux (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import node from '@astrojs/node';

// https://astro.build/config
export default defineConfig({
  site: 'https://astro.build',
  base: '/hello',
  output: 'server',
  adapter: node({
    mode: 'standalone',
  }),
  integrations: [sitemap()],
});

sitemap generate wrong link: https://astro.build/helloworld/

What's the expected result?

https://astro.build/hello/world/

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-85nlia

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 15, 2024
@BeanWei
Copy link
Author

BeanWei commented Jan 15, 2024

* remove the initial slash from relative pathname
* because `finalSiteUrl` always has trailing slash
*/
const fullPath = finalSiteUrl.pathname + r.generate(r.pathname).substring(1);

why because finalSiteUrl always has trailing slash ?

@andremralves
Copy link
Contributor

Apparently it happens only with ssr adapters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants