..I have a Next.js application with multi-language support (English as the default language and German as the secondary one - English is on https://mywebsite.com and German on https://mywebsite.com/de).
I'm using next-sitemap
to generate a sitemap for the page using alternate refs to link the English and German versions of the pages. The following is my next-sitemap config:
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: `https://mywebsite.com`,
generateRobotsTxt: true,
exclude: ['/app/*', '/social-redirect'],
robotsTxtOptions: {
policies: [
{
userAgent: '*',
[process.env.VERCEL_ENV !== 'preview' && process.env.VERCEL_ENV !== 'development'
? 'allow'
: 'disallow']: '/',
},
],
},
alternateRefs: [
{
href: 'https://mywebsite.com',
hreflang: 'en',
},
{
href: 'https://mywebsite.com/de',
hreflang: 'de',
},
],
};
In the generated sitemap the English entries of the sitemap look good. They have the correct alternate refs. But in the German entries of the sitemap, the alternate refs have the language in the path twice, so for example: https://mywebsite.com/de/de/blog
. Is this an issue of next-sitemap
or am I doing something wrong? I would be glad if someone could help me with that!