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

[Feature Request] Ability to add lastmod tositemap.defaults or to the routeRules #5

Closed
3 tasks done
madebyfabian opened this issue Jan 21, 2023 · 2 comments
Closed
3 tasks done
Labels
enhancement New feature or request

Comments

@madebyfabian
Copy link

Clear and concise description of the problem

I am currrently moving a small project from nuxt 2 -> nuxt 3 and saw that the @nuxtjs/sitemap module is not maintained. So I moved over to this and everything works fine. Except, I had a lastmod date default in my config, to add this date to all entries.

I could not find a way to archive this in this module. Maybe this is by design, and the lastmod date is not required for sitemaps. If so, I'll add a PR to the docs of this module to point this out.

If you think this option is also useful, I can submit a PR for it.

Suggested solution

  • I tried to apply it to the sitemap option, but thesitemap.defaults option is not available.
sitemap: {
    hostname: "https://example.com",
    defaults: { lastmod: new Date() },
}
  • I tried to apply it to the routeRules, but this option is also not available.
routeRules: {
  '/': { sitemap: { changefreq: 'weekly', priority: 1, lastmod: new Date() } },
},

Alternative

No response

Additional context

No response

Validations

@madebyfabian madebyfabian added the enhancement New feature or request label Jan 21, 2023
@madebyfabian madebyfabian changed the title [Feature Request] AB [Feature Request] Ability to add lastmod tositemap.defaults or to the routeRules Jan 21, 2023
@harlan-zw
Copy link
Collaborator

Hey @madebyfabian

Thanks for the issue! A great suggestion. I believe this was already supported, just the types hadn't been set up.

Can you upgrade to v1 and let me know how it goes.

You might need to set up the route rule as

  '/about': {
      sitemap: {
        lastmod: new Date().toString(),
        changefreq: 'daily',
        priority: 0.3
      }
    },

@madebyfabian
Copy link
Author

@harlan-zw Works like a charm! Upgraded and added the option. Thank you!

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

No branches or pull requests

2 participants