Sitemap

Builds sitemap.xml files from Payload collections and static URLs, then stores them in any Payload storage adapter.

Community 3 MIT v0.1.0

Installation

pnpm add @seshuk/payload-plugin-sitemap

About

This plugin builds XML sitemaps from your Payload content and keeps them current. You list the sources in a `sources` array. A source can be a collection with a URL pattern such as `/blog/:slug`, a static list of pages, or a custom function that returns URLs. Output includes index and child sitemaps, split at the 50,000 URL or 50 MB limits, with image entries and hreflang alternates for locales. The plugin hooks into document changes. Creating, updating, or deleting a document in a listed collection queues a `sitemap-generate` Payload job. The job waits `jobs.regenerate.delay` (5 minutes by default) so that several edits share one run. It writes the XML, uploads only the files that changed to the files collection, and then switches the public endpoints to the new set in one write to a hidden `sitemap-status` global. If a run fails before that switch, the previous files stay online. Files are stored through whatever storage adapter the project already uses, including S3, R2, Bunny, Vercel Blob, local disk, or a custom upload function, and can be pushed to a CDN with the `publish` option. The sitemap only lists published documents, and it reads documents as an anonymous visitor, so the collection's `read` access decides what appears. Collections that rely on Payload's default access will list nothing until they allow public reads or the source sets `overrideAccess`. With the multi-tenant plugin, tenants are not split into separate sitemaps unless the `tenants` option is set. Generation needs a job runner, such as `jobs.autoRun`, a cron calling `payload jobs:run`, or a custom worker. The admin panel gets a Sitemap page and a dashboard widget with run status, a file table, and a Regenerate button. The plugin targets Payload 4 beta on Next.js or TanStack Start and requires Node.js 24.15 or later.

Package info

Package name
@seshuk/payload-plugin-sitemap
Latest version
0.1.0
Unpacked size
660 kB
License
MIT
Last publish
Oct 14, 2026

More from maximseshuk

View profile

Similar plugins

More in SEO