Files
help-site/app/sitemap.ts
Cursor Agentandz ea0c08c1e4 Localize the help page into 16 languages.
English stays at /. Each other locale is a static directory with its own
lang and dir, hreflang, and a translated catalog. A missing key still
renders the English sentence.

Co-authored-by: z <[email protected]>
2026-10-29 00:51:20 +00:00

21 lines
743 B
TypeScript

import type { MetadataRoute } from "next";
import { pageAlternates } from "@/lib/i18n/locales";
export const dynamic = "force-static";
/**
* One `<url>` per locale, each carrying the whole alternate set, including its
* own. A sitemap that lists the translations only on the default URL is ignored.
* `pageAlternates` is `@hanzo/i18n`'s reciprocal set, `x-default` included.
*/
export default function sitemap(): MetadataRoute.Sitemap {
const languages = Object.fromEntries(pageAlternates().map((item) => [item.hreflang, item.href]));
return pageAlternates()
.filter((item) => item.hreflang !== "x-default")
.map((item) => ({
url: item.href,
changeFrequency: "weekly",
alternates: { languages },
}));
}