question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@nuxt/sitemap not supported?

See original GitHub issue

Hi! I’m using nuxt-generate-cluster to generate my static site (nuxt-generate -b). Latest version of Nuxt, latest everything. At the end of my generation, under normal circumstances (i.e. nuxt generate), my sitemap gets generated. Great! However, with nuxt-generate-cluster, this doesn’t seem to happen. Is there any way I can manually generate the sitemap, or add a hook the end of this other generate function?

nuxt.config.js:

...
modules: [
    'nuxt-i18n',
    '@nuxtjs/feed',
    '@nuxtjs/sitemap',
  ],
...
  generate: {
    dir: './docs',
    fallback: '404.html',
    workers: 4,
    workerConcurrency: 20,
    concurrency: 20,
    routes: () => {...}
  },
...
<div align="right">This question is available on Nuxt community (#c11)</div>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
pimliecommented, Jan 17, 2020

@nuxt/sitemap creates the sitemap in the generate:done hook. This is incompatible with nuxt-generate-cluster as the generate:done hook will be called for every batch that a worker completes. Also the route cache will be empty as the cache is filled on the master and the generate:done hook is called on the workers.

Untested, but ncg has a done hook you could maybe use to manually call the generate:done hook on the master. Unfortunately this doesnt receive the nuxt instance, so you need to get that from a nuxt hook: Since v.2.7.0 the Nuxt instance is passed as second arg to the done method:

// nuxt.config.js
...
  generate: {
    done({ duration, errors, workerInfo }, nuxt) {
      nuxt.callHook('generate:done')
    }
  }

Its a bit hacky but it might just work 😉

0reactions
simplenotezycommented, Jun 17, 2020

@sebbean pro tip: build locally, then use Netlify CLI to push your code; that way you don’t need to bypass the build minutes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sitemap.xml not generating · Issue #18 · nuxt ... - GitHub
The sitemap is not running when I run the build command. Below is the configuration for modules and sitemap. I am importing axios...
Read more >
nuxt sitemap not working properly when used with nuxt-i18n
When setup the config for nuxt-i18n in nuxt sitemap config the sitemap is not rendering properly. sitemap: { hostname: 'http://localhost:8080', ...
Read more >
Sitemap options - Nuxt Sitemap Module
Routes Declaration​​ By default, the dynamic routes are ignored by the sitemap module. Nuxt cannot automatically provide this type of complex routes. If...
Read more >
@nuxtjs/sitemap NPM | npm.io
Routes Declaration. By default, the dynamic routes are ignored by the sitemap module. Nuxt cannot automatically provide this type of complex routes. Example:...
Read more >
Working With Sitemaps in Nuxt.js - DEV Community ‍ ‍
Zip or not, it is up to you to decide. Simple Single Sitemap With Routes. So, usually if you have your own portfolio...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found