harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
949 stars 56 forks source link

Sitemap chunking AND i18n #200

Open gianLuigiL opened 3 months ago

gianLuigiL commented 3 months ago

Details

I can't for the life of me get sitemap to generate multiple sitemaps with i18n. And instead it generated a single sitemap for the language with 94k urls.

My config for sitemap:

  sitemap: {
    sitemaps: true,
    exclude: [
      "/admin/**",
      "/request-new-password",
      "/reset-password",
      "/verify-email",
    ],
    sources: ["/api/__sitemap__/urls"],
    // 24 hours
    cacheMaxAgeSeconds: 3600 * 24,
  }

My config for i18n:

{
    baseUrl: process.env.NUXT_PUBLIC_SITE_URL,
    locales,
    strategy: "prefix",
    defaultLocale: "it", // default locale of your project for Nuxt pages and routings
    lazy: true,
    langDir: "i18n/locales/",
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: "i18n_redirected",
      redirectOn: "root", // recommended
    },
    vueI18n: "./nuxt-i18n.js",
  }

The endpoint in server/api returns an array if this type:

[{
        loc: `/pannelli-fotovoltaici-usati/offerte-${deburr(ad.producer)}-${deburr(ad.model)}-${deburr(ad.city)}-${ad.id}`,
        _i18nTransform: true,
        images: [{ loc: ad.image }],
        lastmod: date(ad.updated_at, "YYYY-MM-DD") ?? undefined,
}]

image

Can somebody see what i'm missing?