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

generate sitemap.xml #386

odanado opened this issue Aug 16, 2020 · 2 comments · Fixed by #479

generate sitemap.xml #386

odanado opened this issue Aug 16, 2020 · 2 comments · Fixed by #479
enhancement New feature or request


Copy link

odanado commented Aug 16, 2020

Is your feature request related to a problem? Please describe.

@nuxtjs/sitemap can generate a sitemap dynamically by specifying the routes option.
But @nuxt/content doesn't support sitemap generation.

Describe the solution you'd like

Update sitemapOptions on the occurrence of the sitemap:generate:before event.

Here's a sample code.

@odanado odanado added the enhancement New feature or request label Aug 16, 2020
Copy link

odanado commented Aug 17, 2020

If nuxt-community/sitemap-module#143 is resolved, this issue will also be resolved.
Therefore, there is no need to do anything.

Copy link

This is my current workaround to generate a sitemap, don't know if it is the best solution but it works for me.


import path from 'path';
import glob from 'glob';
sitemap: {
    hostname: URL,
    path: 'sitemap.xml',
    routes: () => {
      const files = glob.sync(path.join(__dirname, '/dist/**/*.html'));
      const urls ={
        const url = path.relative(
            __dirname, '/dist/'), 
          ).replace('index.html', '');
          return {
            url: url,
            lastmodfile: file
     return urls;
    i18n: true,
    cacheTime: 1000 * 60 * 60 * 2,
    trailingSlash: true,
    gzip: true


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
enhancement New feature or request
None yet

Successfully merging a pull request may close this issue.

2 participants