The sitemap is not running when I run the build
command.
Below is the configuration for modules and sitemap.
I am importing axios at the start of the nuxt.config.js
file
modules: ['@nuxtjs/sitemap'],
sitemap: {
hostname: 'https://karaimusic.com',
routes () {
return axios.get('https://karaimusic.co.uk/wp-json/wp/v2/posts?categories=2')
.then(res => res.data.map(track => {
const path = '/tracks/' + track.slug
console.log(path)
return path
}))
}
}
Axios is getting the data properly because I'm able to print out the slugs of my posts properly
/tracks/parquet-courts-almost-had-to-start-a-fight-in-and-out-of-patience
/tracks/iceage-catch-it
Where am I going wrong?
What else can I check?
is it possible to make one sitemap file and in that file, we include 5 sitemaps other files?
Like I want to divide the big sitemap file into smaller 2 or 3 files,
Because my links combination are crossing more than 50 or 60k
@crabdul did you fixed the issue, did you put the modification date and frequency while using the axios request. I am also stuck
@crabdul, I have tried your use case, it works fine for me!
My steps to reproduce:
// starting from an empty project with Nuxt.js 1.4.0 from starter-template $ npm install @nuxtjs/sitemap $ npm install axios // edit the nuxt.config.json with your configuration, // add on top `const axios = require('axios')` $ npm run build $ npm run start // open http://localhost:3000/sitemap.xml