N
Nuxt8mo ago
Ivan Ortiz

@nuxt/sitemap dont's generating xml

Hi i'm triying to generate a sitemap with @nuxt js/sitemap coming from a external url. After add at the end of modules '@nuxt js/sitemap' I add this configuration in the nuxt.config.ts. But not seems to work. sitemap: { path: '/sitemap.xml', hostname:process.env.HOST_NAME, sources: ['https://strapi.walaxiadev.ovh/api/sitemap/generate'], excludeAppSources: true, defaults: { changefreq: 'daily', priority: 1, lastmod: new Date() } }, If I go to the route /sitemap.xml I redirects to this page Someone can help us?.
No description
12 Replies
manniL
manniL8mo ago
this is fine 👍
View the page source to see the raw XML
Ivan Ortiz
Ivan Ortiz8mo ago
https://strapi.walaxiadev.ovh/api/sitemap/generate This is the endpoint and i need to pass this to the plugin for transform this list of url in a xml. How i can transform it and how can i check the final xml In view-source it doesn't appears too. If you see a sitemap.xml in the production site is uploaded by us manually. We are in the test site in local.
manniL
manniL8mo ago
ohh, got it
Ivan Ortiz
Ivan Ortiz8mo ago
Excuse me. I don't understand your answers.
manniL
manniL8mo ago
the URL has a 502 for me
Ivan Ortiz
Ivan Ortiz8mo ago
Excuse us. We activate pm2
manniL
manniL8mo ago
works fine for me be aware that it won't work in stackblitz if your sitemap URL does not allow CORS
manniL
manniL8mo ago
No description
manniL
manniL8mo ago
settings:
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: ['@nuxtjs/sitemap'],
site: {
url: 'http://example.com',
},
sitemap: {
sources: ['https://strapi.walaxiadev.ovh/api/sitemap/generate'],
},
});
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: ['@nuxtjs/sitemap'],
site: {
url: 'http://example.com',
},
sitemap: {
sources: ['https://strapi.walaxiadev.ovh/api/sitemap/generate'],
},
});
Ivan Ortiz
Ivan Ortiz8mo ago
Thanks. Ok i create a minimum reproduction in stackblitz and then i see what happen i18n is disabling sources any other configuration. I try it with and without excludeAppSources https://stackblitz.com/edit/nuxt-starter-dc1h21?file=nuxt.config.ts
Ivan
StackBlitz
Nuxt Sitemap - Dynamic URLs (forked) - StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
Ivan Ortiz
Ivan Ortiz8mo ago
If that's not the right way can someone show me an example. please? I create directly an endpoint in nuxt without Nuxt sitemap
Want results from more Discord servers?
Add your server