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: Multi sitemaps with i18n #360

Open ronenteva opened 2 months ago

ronenteva commented 2 months ago

🆒 Your use case

When using both multi sitemaps and i18n, it will be useful to still have a separate sitemap for each language.

nitro.config.js:

sitemap: {
    sitemaps: {
      shirts: {
        sources: ['/api/sitemap/shirts']
      }
    }
  }

/api/sitemap/shirts:

export default defineSitemapEventHandler(async () => {
  return [{
    loc: `/shirts/white`,
    _i18nTransform: true
  }];
});

This will generate /__sitemap__/shirts.xml which contains pages in all languages.

🆕 The solution you'd like

/__sitemap__/shirts/en.xml
/__sitemap__/shirts/es.xml
...

🔍 Alternatives you've considered

No response

ℹī¸ Additional info

Thank you :pr

harlan-zw commented 2 months ago

Google does not support nesting multiple index sitemaps within each other so this is not something I will implement, sorry.

ronenteva commented 2 months ago

Oh right, sorry about that. What about /__sitemap__/shirts-en.xml?

harlan-zw commented 2 months ago

It's possible but it's unlikely I'll attempt this any time soon as there's quite a bit of complixity involved in supporting this.