N
Nuxt3mo ago
wszymanski

Nuxt Sitemap module does nothing

hi! I followed https://nuxtseo.com/sitemap/getting-started/installation steps and after viewing /sitemap.xml , I just get redirected to 404 page. I get exactly the same results if I comment the module out in nuxt.config, whether I provide more config sitemaps: { sitemaps: ... } }. All I get is nothing, nothing works. Is there some obvious configuration missing from this documentation page? My versions:

"nuxt": "^3.8.0",
"@nuxtjs/sitemap": "^6.0.1",

"nuxt": "^3.8.0",
"@nuxtjs/sitemap": "^6.0.1",
My nuxt.config:
...
modules: [
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'@nuxtjs/sitemap',
],
site: {
url: 'https://www.example.com',
},
...
...
modules: [
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'@nuxtjs/sitemap',
],
site: {
url: 'https://www.example.com',
},
...
So, when loading my app at localhost:3000/sitemap.xml, I land on localhost:3000/en/sitemap.xml with 404 template. Help me, please.
Nuxt SEO
Install Nuxt Sitemap · Nuxt SEO
Get started with Nuxt Sitemap by installing the dependency to your project.
13 Replies
!NEXOS CREATOR
!NEXOS CREATOR3mo ago
In development mode, the sitemap won't be generated automatically. To preview the sitemap, try running:
npx nuxi preview
npx nuxi preview
This will generate the sitemap.xml file for you to view. Alternatively, in production, you can run:
npx nuxi build
npx nuxi build
Once deployed, the sitemap will be available at https://example.com/sitemap.xml.
wszymanski
wszymanskiOP3mo ago
thanks for quick reply! yeah I tried but that throws whole bunch of other errors
[nuxt] [request error] [unhandled] [500] Cannot find module '.../.output/server/node_modules/vue/server-renderer/index.mjs' imported from .../.output/server/chunks/handlers/renderer.mjs
[nuxt] [request error] [unhandled] [500] Cannot find module '.../.output/server/node_modules/vue/server-renderer/index.mjs' imported from .../.output/server/chunks/handlers/renderer.mjs
!NEXOS CREATOR
!NEXOS CREATOR3mo ago
Its look like this https://discord.com/channels/473401852243869706/1080872789940121732/1274268691223281726 It error from vue/server-render module, upgrade your nuxt app
wszymanski
wszymanskiOP3mo ago
Thanks, will try later
harlan
harlan3mo ago
If you can make a reproduction (https://nuxtseo.com/sitemap/getting-started/stackblitz) I can help
Nuxt SEO
Reproductions: Stackblitz · Nuxt SEO
Create minimal reproductions for Nuxt Sitemap or just experiment with the module.
harlan
harlan3mo ago
but yeh looks like a dependency conflict, run nuxi upgrade --force
wszymanski
wszymanskiOP3mo ago
I did a force update, now I get this while running dev mode:
WARN Module @nuxtjs/sitemap is disabled due to incompatibility issues: 3:16:57 PM
- [nuxt] Nuxt version >=3.9.0 is required but currently using 3.8.0
WARN Module @nuxtjs/sitemap is disabled due to incompatibility issues: 3:16:57 PM
- [nuxt] Nuxt version >=3.9.0 is required but currently using 3.8.0
seems like it only upgraded to 3.8 ? ran gaian, now have 3.13 version... but a new Error
[3:22:54 PM] ERROR [worker reload] [worker init] The requested module 'file:///.../node_modules/.pnpm/[email protected]/node_modules/ufo/dist/index.mjs' does not provide an export named 'joinRelativeURL'

import { parseURL, withoutBase, joinURL, getQuery, withQuery, withTrailingSlash, hasProtocol, withHttps, withoutProtocol, withLeadingSlash, withoutTrailingSlash, withBase, joinRelativeURL, parsePath, parseQuery, stringifyQuery, encodePath, stringifyParsedURL, withoutLeadingSlash } from '.../node_modules/.pnpm/[email protected]/node_modules/ufo/dist/index.mjs';
^^^^^^^^^^^^^^^
[3:22:54 PM] ERROR [worker reload] [worker init] The requested module 'file:///.../node_modules/.pnpm/[email protected]/node_modules/ufo/dist/index.mjs' does not provide an export named 'joinRelativeURL'

import { parseURL, withoutBase, joinURL, getQuery, withQuery, withTrailingSlash, hasProtocol, withHttps, withoutProtocol, withLeadingSlash, withoutTrailingSlash, withBase, joinRelativeURL, parsePath, parseQuery, stringifyQuery, encodePath, stringifyParsedURL, withoutLeadingSlash } from '.../node_modules/.pnpm/[email protected]/node_modules/ufo/dist/index.mjs';
^^^^^^^^^^^^^^^
cleared node_modules, run pnpm prune, fresh pnpm install - still the same
harlan
harlan3mo ago
do pnpm why ufo likely one of your dependencies is requiring an old version
wszymanski
wszymanskiOP3mo ago
OK, here is what helped: - delete root node_modules ( not symlinked ) - delete lock file - pnpm i now it started working, thanks for being a "rubber duck" ! 😉
harlan
harlan3mo ago
this is basically what nuxi upgrade --force should do so bit strange 🤔
wszymanski
wszymanskiOP3mo ago
morning! after I got all to work, I have a question - I need to provide a static link to another sitemap XML ( I am running 2 apps under the same domain ), if I do it via this config:
export default {
autoI18n: false,
sitemaps: {
default: {
dynamicUrlsApiEndpoint: '/sitemap-default',
},
shop: {
urls() {
return ['shop/sitemapindex.xml']
},
},
...
},
}
export default {
autoI18n: false,
sitemaps: {
default: {
dynamicUrlsApiEndpoint: '/sitemap-default',
},
shop: {
urls() {
return ['shop/sitemapindex.xml']
},
},
...
},
}
it gives me a "shop" sub-sitemap with just 1 link inside, obviously is ther a way to skip this page and have a link on the 1st level sitemap? I wonder if that double-nesting can have seo consequence
harlan
harlan3mo ago
Nuxt SEO
Multi Sitemaps · Nuxt SEO
Generate multiple sitemaps for different sections of your site.
wszymanski
wszymanskiOP3mo ago
ohhh thank you! 🙌
Want results from more Discord servers?
Add your server