nuxt-modules / sitemap

Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.
https://nuxtseo.com/sitemap
MIT License
336 stars 31 forks source link

feat: Dynamic chunking #361

Closed ronenteva closed 2 months ago

ronenteva commented 2 months ago

🆒 Your use case

Following #360 and #265, as user needs can become complicated and specific, I suggest supporting an api endpoint for dynamic chunking.

🆕 The solution you'd like

export default defineNuxtConfig({
  sitemap: {
    sitemapsSource: '/api/sitemap-index`
  }
})
export default defineSitemapIndexEventHandler(async () => {
  return categories.map(category=>{
    return locales.map(locale=>{
      return pages.map(page=>{
        return {
          sitemap: `sitemap-${locale}-${category}-${page}`,
          source: `...`
        }
      })
    })
  })

🔍 Alternatives you've considered

No response

ℹī¸ Additional info

No response

harlan-zw commented 2 months ago

Thanks for the suggestion, I don't plan on adding any support for this outside of the Nitro hook which should let you customize the output however you like.

See https://nuxtseo.com/sitemap/nitro-api/nitro-hooks#sitemapindex-resolved

ronenteva commented 2 months ago

Oh perfect, that's definitely good enough, thanks!