next-sitemap
next-sitemap copied to clipboard
undefined/sitemap.xml undefined/sitemap-0.xml
when npm run build and npm run post build i get the result of undefind and i provided my siteUrl. here my files are :
next-sitemap.config.js /** @type {import('next-sitemap').IConfig} */
const config = { siteUrl:"https://devspace.krd"||process.env.SITE_URL, generateRobotsTxt: true, // (optional) // ...other options outDir : "./out",
}
And here its my package.json data
"scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "postbuild": " next-sitemap --next-sitemap.config.js" },
You are using wrong syntax.
This is the correct one:
"postbuild": "next-sitemap --config next-sitemap.config.js"
I used your syntax too but again it does not fixes my problem
and this is my next-sitemap.config.js
@Kawan-edres Can you provide a basic reproduction?
Thanks for your response , but what do you mean by reproduction , I did build my web page again do you mean rebuild or what ?
Almost likely you are passing undefined
to siteUrl
.
Check that you have properly set up your .env
files and you are passing the right one.
and this is my next-sitemap.config.js
Hello there. it seems like you are not exporting your config yet?
you can try to export it by adding this code below your config variable
module.exports = { ...config };
and this is my next-sitemap.config.js
Hello there. it seems like you are not exporting your config yet? you can try to export it by adding this code below your config variable
module.exports = { ...config };
Thanks a lot it fixes my problem I appreciate your answer
Closing this issue due to inactivity.