Files
deckyvault/app/sitemap.ts
T
adrianbonpin 863358a8fd fix: resolve Next.js 16 build errors
- Extract Elysia app from route.ts into lib/api/app.ts to avoid
  Next.js 16 invalid export validation ('app' is not a valid route
  export field)
- Remove runtime='nodejs' from opengraph-image.tsx (invalid segment
  config in Next.js 16)
- Replace computed revalidate expression in sitemap.ts with literal
  (Next.js cannot statically evaluate BinaryExpression for segment
  configs)
- Update eden.ts imports to match new app.ts location
2026-05-05 00:36:17 +08:00

31 lines
1.2 KiB
TypeScript

import type { MetadataRoute } from "next"
import { buildStaticEntries } from "@/lib/sitemap/build-static-entries"
import { fetchDynamicEntries } from "@/lib/sitemap/fetch-dynamic-entries"
/**
* ISR-style revalidation window in seconds.
*
* Next.js caches the sitemap and regenerates it at most once per
* revalidation window. Between regenerations, the cached response
* is served instantly from memory (and from Cloudflare's edge via
* the `s-maxage` directive).
*
* On-demand purging is handled by `/api/revalidate-sitemap` which
* calls `revalidatePath("/sitemap.xml")`.
*/
export const revalidate = 3600
/**
* Generates the sitemap for deckyvault.xyz.
*
* Combines static pages with dynamic game and device entries from
* the database. The result is cached by Next.js with ISR semantics
* so crawlers always get a fast response even during cold starts
* (the cache is persisted to disk in self-hosted Docker setups).
*/
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const staticEntries = buildStaticEntries()
const { gameEntries, deviceEntries } = await fetchDynamicEntries()
return [...staticEntries, ...gameEntries, ...deviceEntries]
}