Closed JenuelDev closed 3 years ago
Fwiw I don't have this problem:
sitemap: {
hostname: process.env.SITEMAP_HOSTNAME,
}
is working.
@BroJenuel as explained in the error message, the hostname
value is mandatory in static target. But your main_base_URL
is empty during the nuxt.config.js
script execution because your Nuxt var envs are setted by that same file.
You have to use a constant as follows:
const main_base_URL = 'https://brojenuel-blog.ml';
export default {
sitemap: {
hostname: main_base_URL
},
env: {
main_base_URL
},
...
}
sitemap: { hostname: main_base_URL }, env: { main_base_URL },
thanks it worked
@BroJenuel as explained in the error message, the
hostname
value is mandatory in static target. But yourmain_base_URL
is empty during thenuxt.config.js
script execution because your Nuxt var envs are setted by that same file.You have to use a constant as follows:
const main_base_URL = 'https://brojenuel-blog.ml'; export default { sitemap: { hostname: main_base_URL }, env: { main_base_URL }, ... }
this doesn't work for me.. was getting this error:
[fatal] [sitemap-module] The `hostname` option is mandatory in your config on `spa` or `generate` build mode
{
"path": "/sitemap.xml",
"exclude": [
"/verify",
"/resetpassword"
],
"routes": [],
"cacheTime": 900000,
"etag": {
"weak": false
},
"gzip": true,
"trailingSlash": false,
"i18n": {
"locales": [
"en"
],
"routesNameSeparator": "/"
},
"defaults": {},
"pathGzip": "/sitemap.xml.gz"
}
Nuxt Fatal Error: [sitemap-module] The `hostname` option is mandatory in your config on `spa` or `generate` build mode
Version
2.15.4
Reproduction link
https://codesandbox.io/s/xenodochial-tree-xr79x?file=/pages/index.vue
Steps to reproduce
Just added the moduel using yarn add @nuxtjs/sitemap, this is my config.
Modules
Sitemap options
What is expected ?
Should generate a sitemap
What is actually happening?
instead an error pops up that says: [sitemap-module] The
hostname
option is mandatory in your config onspa
orgenerate
build mode