Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sitemap.xml not generating #18

Closed
crabdul opened this issue Mar 9, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@crabdul
Copy link

commented Mar 9, 2018

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?

This question is available on Nuxt.js community (#c11)
@NicoPennec

This comment has been minimized.

Copy link
Member

commented Mar 9, 2018

@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
@crabdul

This comment has been minimized.

Copy link
Author

commented Mar 11, 2018

Thank you for your help!

I assumed it wasn't generating the sitemap because the sitemap.xml file doesn't appear in .nuxt when I run the build command

@crabdul crabdul closed this Mar 11, 2018

This comment has been minimized.

Copy link

commented Feb 12, 2019 — with CMTY

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

@amjadkhan896

This comment has been minimized.

Copy link

commented Feb 12, 2019

@crabdul did you fixed the issue, did you put the modification date and frequency while using the axios request. I am also stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.