diyaa.de/app/sitemap.ts
2026-03-13 09:26:40 +01:00

32 lines
970 B
TypeScript

import type { MetadataRoute } from "next";
import { getLocalizedPath, siteConfig } from "@/lib/site";
import { isComingSoonMode } from "@/lib/site";
import type { Locale } from "@/lib/i18n";
const allPages = ["", "/about", "/contact"] as const;
const allLocales = ["ar", "en"] as const;
export default function sitemap(): MetadataRoute.Sitemap {
const lastModified = new Date();
const comingSoon = isComingSoonMode();
const pages: readonly (typeof allPages)[number][] = comingSoon ? [] : allPages;
const locales: readonly Locale[] = comingSoon ? [] : allLocales;
return [
{
url: siteConfig.siteUrl,
lastModified,
changeFrequency: "weekly",
priority: 0.8,
},
...pages.flatMap((page) =>
locales.map((locale) => ({
url: `${siteConfig.siteUrl}${getLocalizedPath(page, locale)}`,
lastModified,
changeFrequency: "weekly" as const,
priority: page === "" ? 1 : 0.7,
})),
),
];
}