import type { MetadataRoute } from "next"; import { loadContent } from "@/site/load"; import { siteBase } from "@/site/meta"; /** * The published pages and the Website's own events (ROADMAP-v3 ยง11). Events copied from Cross * Events aren't listed: their canonical page is at the origin. Before the first publish: empty. */ export default async function sitemap(): Promise { const c = await loadContent(); if (c.mode !== "published") return []; const base = siteBase(c); if (!base) return []; const at = (path: string) => new URL(path, base).toString(); return [ ...c.snapshot.pages.map((p) => ({ url: at(p.path), changeFrequency: "weekly" as const, priority: p.kind === "home" ? 1 : 0.7 })), ...c.events.filter((e) => e.from === "website" && e.slug).map((e) => ({ url: at(`/events/${e.slug}`), changeFrequency: "weekly" as const, priority: 0.5 })), ]; }