Skip to content

createVexSitemap

createVexSitemap<Query>(props): () => Promise<SitemapFile>

Defined in: packages/next/src/seo/createVexSitemap.ts:18

Creates a Next.js sitemap.ts default export from a Convex published-slugs query (packages/core/src/api/publishedSlugs/server.ts).

Tolerates an unreachable Convex deployment (P-020): a read failure returns [] — an empty sitemap — rather than failing the build.

Query extends FunctionReference<"query">

Sitemap configuration.

OptionalRestArgs<Query>[0]

VexServerClient

(item) => string

(item) => number | undefined

Optional last-modified extractor. Omit it when the collection carries no modification timestamp — Convex’s _creationTime is set at insert and never moves, so reporting it as lastModified would be a lie. lastModified is optional in the sitemap protocol; an absent value is correct, a wrong one costs crawl budget.

May return undefined for an individual item, and that is the common case: defineCollection injects updatedAt on every content collection, but only a write through create/update populates it — a seeded or imported row has none. Those entries are emitted with no lastModified rather than an Invalid Date.

Query

(slug) => string

Maps one item’s slug to its absolute public URL — the route mapper, so URL shape (e.g. /blog/[slug] vs /[slug]) is the caller’s choice.

A sitemap() function suitable as app/sitemap.ts’s default export.

() => Promise<SitemapFile>