Builds an XML sitemap automatically from selected Payload collections. It adds per-document exclude and priority fields, supports custom routes and URL generation, and serves the sitemap through a plugin endpoint. Optional caching stores the generated result in a sitemap global. Requires Payload 3.28.1 or later and a configured hostname.
Payload Sitemap Plugin
Installation
npm i payload-sitemap-plugin46
Stars
3
Forks
4
Open Issues
1 years ago
Last Updated
159
Weekly Downloads
v0.0.6
npm Version
61.1 KB
Unpacked Size
1
Dependencies
46+1 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 46 |
| Dec 5, 2026 | 46 |
| Dec 4, 2026 | 46 |
| Dec 3, 2026 | 46 |
| Dec 2, 2026 | 46 |
| Dec 1, 2026 | 46 |
| Nov 30, 2026 | 46 |
| Nov 29, 2026 | 46 |
| Nov 28, 2026 | 46 |
| Nov 27, 2026 | 46 |
| Nov 26, 2026 | 46 |
| Nov 25, 2026 | 46 |
| Nov 24, 2026 | 47 |
| Nov 23, 2026 | 47 |
| Nov 22, 2026 | 47 |
| Nov 21, 2026 | 47 |
| Nov 20, 2026 | 47 |
| Nov 19, 2026 | 47 |
| Nov 18, 2026 | 47 |
| Nov 17, 2026 | 47 |
| Nov 16, 2026 | 47 |
| Nov 15, 2026 | 47 |
| Nov 14, 2026 | 47 |
| Nov 13, 2026 | 47 |
| Nov 12, 2026 | 47 |
| Nov 11, 2026 | 47 |
| Nov 10, 2026 | 47 |
| Nov 9, 2026 | 47 |
| Nov 8, 2026 | 47 |
| Nov 7, 2026 | 47 |
| Nov 6, 2026 | 47 |
| Nov 5, 2026 | 47 |
| Nov 4, 2026 | 47 |
| Nov 3, 2026 | 47 |
| Nov 2, 2026 | 47 |
| Nov 1, 2026 | 47 |
| Oct 31, 2026 | 47 |
| Oct 30, 2026 | 47 |
| Oct 29, 2026 | 47 |
| Oct 28, 2026 | 47 |
| Oct 27, 2026 | 47 |
| Oct 26, 2026 | 47 |
| Oct 25, 2026 | 47 |
| Oct 24, 2026 | 47 |
| Oct 23, 2026 | 47 |
| Oct 22, 2026 | 47 |
| Oct 21, 2026 | 46 |
| Oct 20, 2026 | 46 |
| Oct 19, 2026 | 46 |
| Oct 18, 2026 | 46 |
| Oct 17, 2026 | 46 |
| Oct 16, 2026 | 46 |
| Oct 15, 2026 | 46 |
| Oct 14, 2026 | 46 |
| Oct 13, 2026 | 46 |
| Oct 12, 2026 | 46 |
| Oct 11, 2026 | 46 |
| Oct 10, 2026 | 46 |
| Oct 9, 2026 | 46 |
| Oct 8, 2026 | 46 |
| Oct 7, 2026 | 46 |
| Oct 6, 2026 | 46 |
| Oct 5, 2026 | 46 |
| Oct 4, 2026 | 46 |
| Oct 3, 2026 | 46 |
| Oct 2, 2026 | 46 |
| Oct 1, 2026 | 46 |
| Sep 30, 2026 | 46 |
| Sep 29, 2026 | 46 |
| Sep 28, 2026 | 46 |
| Sep 27, 2026 | 46 |
| Sep 26, 2026 | 46 |
| Sep 25, 2026 | 46 |
| Sep 24, 2026 | 46 |
| Sep 23, 2026 | 46 |
| Sep 22, 2026 | 46 |
| Sep 21, 2026 | 46 |
| Sep 20, 2026 | 46 |
| Sep 19, 2026 | 46 |
| Sep 18, 2026 | 46 |
| Sep 17, 2026 | 46 |
| Sep 16, 2026 | 46 |
| Sep 15, 2026 | 45 |
| Sep 14, 2026 | 45 |
| Sep 13, 2026 | 45 |
| Sep 12, 2026 | 45 |
| Sep 11, 2026 | 45 |
| Sep 10, 2026 | 45 |
| Sep 9, 2026 | 45 |
| Sep 8, 2026 | 45 |
| Sep 7, 2026 | 45 |
159+19 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 159 |
| Dec 5, 2026 | 130 |
| Dec 4, 2026 | 147 |
| Dec 3, 2026 | 128 |
| Dec 2, 2026 | 109 |
| Dec 1, 2026 | 111 |
| Nov 30, 2026 | 147 |
| Nov 29, 2026 | 157 |
| Nov 28, 2026 | 175 |
| Nov 27, 2026 | 196 |
| Nov 26, 2026 | 150 |
| Nov 25, 2026 | 153 |
| Nov 24, 2026 | 167 |
| Nov 23, 2026 | 181 |
| Nov 22, 2026 | 174 |
| Nov 21, 2026 | 166 |
| Nov 20, 2026 | 266 |
| Nov 19, 2026 | 287 |
| Nov 18, 2026 | 315 |
| Nov 17, 2026 | 317 |
| Nov 16, 2026 | 267 |
| Nov 15, 2026 | 308 |
| Nov 14, 2026 | 312 |
| Nov 13, 2026 | 183 |
| Nov 12, 2026 | 175 |
| Nov 11, 2026 | 156 |
| Nov 10, 2026 | 179 |
| Nov 9, 2026 | 185 |
| Nov 8, 2026 | 193 |
| Nov 7, 2026 | 276 |
| Nov 6, 2026 | 423 |
| Nov 5, 2026 | 436 |
| Nov 4, 2026 | 495 |
| Nov 3, 2026 | 441 |
| Nov 2, 2026 | 436 |
| Nov 1, 2026 | 390 |
| Oct 31, 2026 | 298 |
| Oct 30, 2026 | 136 |
| Oct 29, 2026 | 101 |
| Oct 28, 2026 | 28 |
| Oct 27, 2026 | 29 |
| Oct 26, 2026 | 28 |
| Oct 25, 2026 | 24 |
| Oct 24, 2026 | 21 |
| Oct 23, 2026 | 16 |
| Oct 22, 2026 | 23 |
| Oct 21, 2026 | 36 |
| Oct 20, 2026 | 37 |
| Oct 19, 2026 | 36 |
| Oct 18, 2026 | 34 |
| Oct 17, 2026 | 44 |
| Oct 16, 2026 | 50 |
| Oct 15, 2026 | 65 |
| Oct 14, 2026 | 76 |
| Oct 13, 2026 | 94 |
| Oct 12, 2026 | 127 |
| Oct 11, 2026 | 130 |
| Oct 10, 2026 | 182 |
| Oct 9, 2026 | 232 |
| Oct 8, 2026 | 251 |
| Oct 7, 2026 | 257 |
| Oct 6, 2026 | 238 |
| Oct 5, 2026 | 206 |
| Oct 4, 2026 | 203 |
| Oct 3, 2026 | 145 |
| Oct 2, 2026 | 107 |
| Oct 1, 2026 | 88 |
| Sep 30, 2026 | 82 |
| Sep 29, 2026 | 88 |
| Sep 28, 2026 | 86 |
| Sep 27, 2026 | 87 |
| Sep 26, 2026 | 83 |
| Sep 25, 2026 | 80 |
| Sep 24, 2026 | 76 |
| Sep 23, 2026 | 123 |
| Sep 22, 2026 | 127 |
| Sep 21, 2026 | 128 |
| Sep 20, 2026 | 131 |
| Sep 19, 2026 | 163 |
| Sep 18, 2026 | 164 |
| Sep 17, 2026 | 178 |
| Sep 16, 2026 | 137 |
| Sep 15, 2026 | 128 |
| Sep 14, 2026 | 142 |
| Sep 13, 2026 | 139 |
| Sep 12, 2026 | 125 |
| Sep 11, 2026 | 117 |
| Sep 10, 2026 | 118 |
| Sep 9, 2026 | 126 |
| Sep 8, 2026 | 148 |
| Sep 7, 2026 | 140 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/948059612-root)<a href="https://payloaddirectory.dev/plugins/948059612-root"><img src="https://payloaddirectory.dev/badge/948059612-root.svg" alt="Payload Directory"></a>README
GoLang client library & SDK for Payload CMS
This plugin provides an automatic way of syncing your Payload collections into a generated Sitemap.
pnpm i payload-sitemap-plugin
import { sitemapPlugin } from 'payload-sitemap-plugin';
export default buildConfig({
plugins: [
sitemapPlugin({
hostname: 'https://example.com',
cache: true,
defaultPriority: 0.5,
includeDrafts: true,
includeHomepage: true,
collections: {
posts: {
priority: 0.8,
changeFreq: 'weekly',
includeDrafts: false,
fieldOverrides: ({ defaultFields }) => [
...defaultFields,
{
name: 'customSEO',
type: 'text',
label: 'Custom SEO Field',
},
],
},
pages: true
},
generateURL: ({ doc }) => `/${doc.slug}`,
customRoutes: [
{
loc: '/about',
priority: 0.7,
lastMod: new Date('2024-01-01')
}
],
globalOverrides: {
fields: ({ defaultFields }) => [
...defaultFields,
{
name: 'extraSetting',
type: 'text',
label: 'Extra Setting',
},
],
},
})
]
});
To make sure search engines are able to find the sitemap XML create a robots.txt file in the front-end of your website
and add the following line:
Sitemap: https://your-payload-domain.com/api/plugin-sitemap/sitemap/index.xml
Read more about the robots.txt
file here.
Two fields are added to the collections that are specified enabling easy customisation of each document in the sitemap.
excludeFromSitemap - A checkbox field to specify whether a document should be excluded from the sitemap.sitemapPriority - A select field to define the priority of a document in the sitemap, with values ranging from 0 to
1.If caching is enabled, a sitemap global is used to store the results of sitemap generation once it has been created.
This global contains a JSON representation of the sitemap, and when it was last modified.
The user is responsible for re-generating sitemaps. Refer to the regenerate endpoint below for instructions on how to manually trigger sitemap regeneration.
Visit the documentation for more details.
| Endpoint | Description | Method |
|---|---|---|
/api/plugin-sitemap/sitemap/index.xml | The generated sitemap XML file. | GET |
/api/plugin-sitemap/regenerate | Endpoint to regenerate the sitemap. | POST |
| Option | Default | Description |
|---|---|---|
hostname | Required | Base URL for absolute links. This is required for generating fully qualified URLs in the sitemap. |
cache | false | Cache configuration for the sitemap. Can be a boolean (enable/disable) or an object with duration and enabled flags. |
cache.duration | 86400 (1 day) | Cache duration in seconds for storing the generated sitemap. |
cache.enabled | false | If true, caching of the generated sitemap will be enabled. |
collections | {} | Collection-specific configuration for the sitemap. Each key corresponds to a collection slug, and custom options can be provided for that collection. |
collections.[key] | - | Settings for a specific collection in the sitemap. If set to true, it includes all documents in that collection with default settings. |
collections.[key].changeFreq | - | Frequency at which pages in this collection are expected to change. Can be overridden for each document. |
collections.[key].includeDrafts | false | If true, drafts for this collection will be included in the sitemap. |
collections.[key].lastModField | - | Custom field to determine the last modified date (lastmod) for documents in the collection. |
collections.[key].priority | - | Default priority for documents in this collection. Can be between 0.0 and 1.0. |
collections.[key].fieldOverrides | - | Function to override or extend the default fields (sitemapPriority and excludeFromSitemap) for this collection. Returns a new array of fields. |
customRoutes | - | Custom routes to include in the sitemap with their own configuration (change frequency, last modified date, priority). |
defaultPriority | 0.5 | Default priority for all documents in the sitemap. Values range from 0.0 (lowest) to 1.0 (highest). |
disabled | false | If set to true, disables the sitemap plugin. |
generateURL | - | Custom function to generate URLs for documents in this collection. |
includeDrafts | false | If true, includes drafts in the sitemap. This is overridden by individual collection settings. |
includeHomepage | true | If true, includes a default / entry in the sitemap. |
globalOverrides | true | Function to override or extend fields on the sitemap global used for caching. Returns a new array of fields. |
<xhtml:link rel="alternate">limit and sitemaps greater than 45,000.Contributions are welcome! If you find any bugs or have suggestions for improvement, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
ainsley.dev and the ainsley.dev logo are either registered trademarks or trademarks of ainsley.dev LTD in the United Kingdom and/or other countries. All other trademarks are the property of their respective owners.
sitemap
Chunked, lazily cached XML sitemaps with hook-driven invalidation and robots.txt helpers
62156/wk16v3
seo
SEO fields, settings global and automatic redirects for Payload, with Next.js metadata, sitemap and robots helpers
75303/wk3v3
payload seo analyzer
Offline on-page SEO analysis, admin dashboard, sitemaps and JSON-LD for Payload 3 and Next.js sites
72880/wk17v3
payload plugin structured data
JSON-LD structured data for Payload pages, editable from admin settings and per-document overrides
6943/wk1v3
payload plugin seo jsonld
JSON-LD builders for Payload v3 shops: Product, BreadcrumbList, ItemList, WebSite and Organization
617/wk1v3
seo
Locale-aware SEO fields, metadata resolution, robots, exact redirects and sitemap helpers
6030/wk0v4