sitemap.ts 876 B

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