My site on Next.js 14 (App Router) has multi-language support and needs to generate sitemap.xml with:
<xhtml:link rel="alternate" hreflang="YOUR_LOCALE" href="YOUR_LINK" />
as Google shows in the following example: https://developers.google.com/search/docs/specialty/international/localized-versions#sitemap
How is it possible to do this?
In Next.js 14 (App Router) sitemap generation you can only specify 4 parameters that have nothing to do with localization: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
Or you can write sitemap.xml manually, but the site has product pages that are more than 2000 and manually doing it is crazy.
Maybe there is a way to build a string yourself? (getServerSideProps - not supported in App Router)