Home > Software engineering >  nuxt sitemap - example.com/sitemap.xml return Internal server error on Layer0 hosting
nuxt sitemap - example.com/sitemap.xml return Internal server error on Layer0 hosting

Time:05-18

I have deployed my nuxtjs application on enter image description here

CodePudding user response:

If you are using SSR with Nuxt, let Nuxt serve the sitemap instead of the static file you would had created with npm run generate. Add the following to your Layer0 router:

.match('/sitemap.xml', ({ renderWithApp }) => {
  renderWithApp()
})

I've updated our documentation with this information: https://docs.layer0.co/guides/nuxt#serving-sitemap-with-ssr

  • Related