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

Generate sitemap with CLI #266

Closed
MickL opened this issue Apr 16, 2024 · 2 comments
Closed

Generate sitemap with CLI #266

MickL opened this issue Apr 16, 2024 · 2 comments

Comments

@MickL
Copy link

MickL commented Apr 16, 2024

Currently it seems like /sitemap.xml is a dynamic route that the Nuxt server resolves rather than an actual file. This might be fine for most use cases but for example on Vercel this will resolve to a 404 page, issue: #256

It would be nice if the sitemap can be generated as a file in the build step by CLI, e.g. nuxt build && nuxt-sitemap generate. This would fix the issue above.

@harlan-zw
Copy link
Collaborator

harlan-zw commented May 6, 2024

Hi, sorry for the delay.

I'm not exactly sure what is going on with Vercel Edge that it doesn't work, but you should just be able to add the sitemap path to the prerender routes and it will generate it statically.

export default defineNuxtConfig({
  nitro: {
    prerender: {
      routes: ['/sitemap.xml']
    }
  }
})

I'm happy to enable the static generation by default on Vercel if you can make a minimal reproduction.

@MickL
Copy link
Author

MickL commented May 6, 2024

This would fix the issue :) I will give it a try soon.

The thing with Vercel is it seems to be looking for a real xml file instead of going through the Nuxt router and then Vercel shows a 404. I will do a reproduction repo.

@harlan-zw harlan-zw closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants