nuxt-modules / sitemap

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

help: _i18nTransform not translate path defined in @nuxt/i18n pages configuration #363

Open fedetorre opened 2 months ago

fedetorre commented 2 months ago

šŸ“š What are you trying to do?

Good morning,

I am try to generate a dynamic sitemap from a list of items. In my project I use @nuxt/i18n for path translations. I have the following configuration of the i18n module:

i18n: { baseUrl: 'https://mydomain.com', locales, defaultLocale: 'en', strategy: 'prefix', detectBrowserLanguage: { useCookie: true, cookieKey: 'i18n_redirected', redirectOn: 'root', }, customRoutes: 'config', // disable custom route with page components pages: { 'terms-and-conditions': { en: 'terms-and-conditions', it: 'termini-e-condizioni', } }, },

If I use the _i18nTransform option for the sitemap generation I'm expecting that the sitemap will have an entry in the en version with /en/terms-and-conditions loc and one in the italian sitemap with the loc /it/termini-e-condizioni but the generated sitemaps has both the terms-and-conditions path at the end without translation. It seems that the _i18nTransform option only append the language prefix in the beginning part of the url. Is it true or I have to configure something else?

Thanks!

šŸ” What have you tried?

No response

ā„¹ļø Additional context

No response

harlan-zw commented 2 months ago

The _i18nTransform config does not support the i18n pages config, I'd suggest having these as a static file if possible. This config should only be needed for dynamic data.

jakubkoje commented 3 weeks ago

I am trying to generate a sitemap for dynamic events from backend. The dynamic page has different paths in different languages. The _i18nTransform does not take this into an account, it just appends for example 'en' in front of the original loc path. Is there a way to make this work? Thanks.

defineI18nRoute({
  paths: {
    sk: '/podujatie/[id]',
    cs: '/udalost/[id]',
    en: '/event/[id]',
  },
})