import type { MetadataRoute } from 'next'; import { absoluteUrl, articlePath, availableLocales, blogPath, indexingEnabled, publishedArticles } from '@/lib/blog/data'; import { appLocales } from '@/lib/i18n/config'; import { localizedPath, publicAppPaths } from '@/lib/i18n/routes'; export default function sitemap(): MetadataRoute.Sitemap { // Keep the review sitemap empty. The release cohort contains all public app // translations plus the reviewed blog inventory; never private user routes. if (!indexingEnabled) return []; return [ ...appLocales.flatMap(locale => publicAppPaths.map(path => ({ url: absoluteUrl(localizedPath(path, locale)) }))), ...availableLocales().map(locale => ({ url: absoluteUrl(blogPath(locale)) })), ...publishedArticles().map(article => ({ url: absoluteUrl(articlePath(article)), lastModified: article.reviewedAt })), ]; }