iamvishnusankar / next-sitemap

Sitemap generator for next.js. Generate sitemap(s) and robots.txt for all static/pre-rendered/dynamic/server-side pages.
https://next-sitemap.iamvishnusankar.com
MIT License
3.25k stars 126 forks source link

undefined/sitemap.xml undefined/sitemap-0.xml #472

Closed Kawan-edres closed 1 year ago

Kawan-edres commented 2 years ago

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" },

yvikasofficial commented 2 years ago

You are using wrong syntax.

This is the correct one: "postbuild": "next-sitemap --config next-sitemap.config.js"

Kawan-edres commented 2 years ago

image I used your syntax too but again it does not fixes my problem

Kawan-edres commented 2 years ago

image

Kawan-edres commented 2 years ago

and this is my next-sitemap.config.js image

iamvishnusankar commented 2 years ago

@Kawan-edres Can you provide a basic reproduction?

Kawan-edres commented 2 years ago

Thanks for your response , but what do you mean by reproduction , I did build my web page again do you mean rebuild or what ?

magoz commented 2 years ago

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.

desmon91 commented 2 years ago

and this is my next-sitemap.config.js image

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 };

Kawan-edres commented 2 years ago

and this is my next-sitemap.config.js image

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

github-actions[bot] commented 1 year ago

Closing this issue due to inactivity.