import type { MetadataRoute } from 'next'; import { routing } from '@/i18n/routing'; import { ROUTES } from '@/constants'; import { SITE_URL } from '@/config'; /** Public, unauthenticated pages only (ui-phase-13) — mirrors `PUBLIC_PATHS` plus the locale root * itself (the guest landing an unauthenticated `/` rewrites to). */ const PUBLIC_SITEMAP_PATHS: string[] = ['', ROUTES.LOGIN, ROUTES.TERMS, ROUTES.PRIVACY]; /** @route /sitemap.xml */ export default function sitemap(): MetadataRoute.Sitemap { return PUBLIC_SITEMAP_PATHS.map((path) => ({ url: `${SITE_URL}/${routing.defaultLocale}${path}`, alternates: { languages: Object.fromEntries( routing.locales.map((locale) => [locale, `${SITE_URL}/${locale}${path}`]), ), }, })); }