{"id":26318185,"url":"https://github.com/ainsleyclark/payload-sitemap-plugin","last_synced_at":"2026-04-27T18:02:18.498Z","repository":{"id":282277254,"uuid":"948059612","full_name":"ainsleyclark/payload-sitemap-plugin","owner":"ainsleyclark","description":"Sitemap Plugin for PayloadCMS","archived":false,"fork":false,"pushed_at":"2025-09-26T10:40:29.000Z","size":251,"stargazers_count":44,"open_issues_count":4,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-15T11:58:34.925Z","etag":null,"topics":["cms","payload","payload-plugin","payloadcms","plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ainsleyclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["ainsleyclark"]}},"created_at":"2025-03-13T17:20:45.000Z","updated_at":"2026-02-05T15:00:32.000Z","dependencies_parsed_at":"2025-06-04T15:36:00.909Z","dependency_job_id":"75696638-dba1-49ac-8d8f-925741313111","html_url":"https://github.com/ainsleyclark/payload-sitemap-plugin","commit_stats":null,"previous_names":["ainsleyclark/payload-sitemap-plugin"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ainsleyclark/payload-sitemap-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fpayload-sitemap-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fpayload-sitemap-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fpayload-sitemap-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fpayload-sitemap-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ainsleyclark","download_url":"https://codeload.github.com/ainsleyclark/payload-sitemap-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fpayload-sitemap-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32348058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cms","payload","payload-plugin","payloadcms","plugin"],"created_at":"2025-03-15T14:17:34.464Z","updated_at":"2026-04-27T18:02:18.470Z","avatar_url":"https://github.com/ainsleyclark.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ainsleyclark"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./res/payload-logo.jpg\" height=\"86\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://ainsley.dev\"\u003e\n        \u003ch2 align=\"center\"\u003ePayload Sitemap Plugin\u003c/h2\u003e\n\t\t\u003cp align=\"center\"\u003eGoLang client library \u0026 SDK for Payload CMS\u003c/p\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Payload CMS Version](https://img.shields.io/badge/Payload%20CMS-3.28.1-2B2D42)](https://payloadcms.com)\n[![npm version](https://img.shields.io/npm/v/payload-sitemap-plugin)](https://www.npmjs.com/package/payload-sitemap-plugin)\n[![Test](https://github.com/ainsleyclark/payload-sitemap-plugin/actions/workflows/test.yaml/badge.svg)](https://github.com/ainsleyclark/payload-sitemap-plugin/actions/workflows/test.yaml)\n[![Lint](https://github.com/ainsleyclark/payload-sitemap-plugin/actions/workflows/lint.yaml/badge.svg)](https://github.com/ainsleyclark/payload-sitemap-plugin/actions/workflows/lint.yaml)\n[![ainsley.dev](https://img.shields.io/badge/-ainsley.dev-black?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5wEYDzUGL1b35AAABA1JREFUWMPtlttvFVUUxn977ZnZu+W0tLalqRovBAUvQag0xNQbpSIosSSIJC198YknJfHJxDf9A/DBJ0x8MbFACjVqvCASq6FYFLFBvJAaAomkFCmhHGpLO+PDzOmZzpn2nKP4pCs5ycmevb7vW99as/fA//FfD1XO5p1nzuA3NWJHx5T8cVkRBPHHQfRjd0tzyZhOOQIy27bAxET9zCuvvhY0r2kC/OiRABeAN4BL/4oDr9+3lGszPs7UVNfUE23v3Nj5koszR/8N4EXg3XJckFIFuCLUuU7GWNNtTg25cu4syJx0F+gGMuU4UJKAt1Yux1UKV6TVat1qs+OYwQESMwDQCjwKsOv4iZsnwGihwbiuEek2WjJGhMrvv0UujYKa08VFkQvuTXNgz6oVeC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Vh0ZGF0ZTptb2RpZnkAMjAyMy0wMS0yNFQxNTo1MzowNiswMDowMOrGXwgAAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII=)](https://ainsley.dev)\n[![Twitter Handle](https://img.shields.io/twitter/follow/ainsleydev)](https://twitter.com/ainsleydev)\n\n\u003c/div\u003e\n\n## Introduction\n\nThis plugin provides an automatic way of syncing your Payload collections into a generated Sitemap.\n\n- ✅ Generates XML Sitemaps directly from your Payload collections.\n- ✅ Configurable cache system and endpoint to regenerate the sitemap.\n- ✅ Extensible with fields and config.\n- ✅ Add custom routes to your sitemap.\n\n## Installation\n\n```bash\npnpm i payload-sitemap-plugin \n```\n\n## Quick Start\n\n```ts\nimport { sitemapPlugin } from 'payload-sitemap-plugin';\n\nexport default buildConfig({\n\tplugins: [\n\t\tsitemapPlugin({\n\t\t\thostname: 'https://example.com',\n\t\t\tcache: true,\n\t\t\tdefaultPriority: 0.5,\n\t\t\tincludeDrafts: true,\n\t\t\tincludeHomepage: true,\n\t\t\tcollections: {\n\t\t\t\tposts: {\n\t\t\t\t\tpriority: 0.8,\n\t\t\t\t\tchangeFreq: 'weekly',\n\t\t\t\t\tincludeDrafts: false,\n\t\t\t\t\tfieldOverrides: ({ defaultFields }) =\u003e [\n\t\t\t\t\t\t...defaultFields,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'customSEO',\n\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\tlabel: 'Custom SEO Field',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tpages: true\n\t\t\t},\n\t\t\tgenerateURL: ({ doc }) =\u003e `/${doc.slug}`,\n\t\t\tcustomRoutes: [\n\t\t\t\t{\n\t\t\t\t\tloc: '/about',\n\t\t\t\t\tpriority: 0.7,\n\t\t\t\t\tlastMod: new Date('2024-01-01')\n\t\t\t\t}\n\t\t\t],\n\t\t\tglobalOverrides: {\n\t\t\t\tfields: ({ defaultFields }) =\u003e [\n\t\t\t\t\t...defaultFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'extraSetting',\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\tlabel: 'Extra Setting',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t})\n\t]\n});\n\n```\n\n## Robots.txt\n\nTo make sure search engines are able to find the sitemap XML create a `robots.txt` file in the front-end of your website\nand add the following line:\n\n```\nSitemap: https://your-payload-domain.com/api/plugin-sitemap/sitemap/index.xml\n```\n\nRead more about the `robots.txt`\nfile [here](https://developers.google.com/search/docs/advanced/robots/create-robots-txt).\n\n## Fields\n\nTwo fields are added to the collections that are specified enabling easy customisation of each document in the sitemap.\n\n- `excludeFromSitemap` - A checkbox field to specify whether a document should be excluded from the sitemap.\n- `sitemapPriority` - A select field to define the priority of a document in the sitemap, with values ranging from 0 to\n  1.\n\n## Caching\n\nIf caching is enabled, a `sitemap` global is used to store the results of sitemap generation once it has been created.\nThis global contains a JSON representation of the sitemap, and when it was last modified.\n\nThe user is responsible for re-generating sitemaps. Refer to the regenerate endpoint below for instructions on how to\nmanually trigger sitemap regeneration.\n\nVisit the [documentation](https://payloadcms.com/docs/jobs-queue/queues#executing-jobs) for more details.\n\n## Endpoints\n\n| Endpoint                                | Description                         | Method |\n|-----------------------------------------|-------------------------------------|--------|\n| `/api/plugin-sitemap/sitemap/index.xml` | The generated sitemap XML file.     | `GET`  |\n| `/api/plugin-sitemap/regenerate`        | Endpoint to regenerate the sitemap. | `POST` |\n\n## Config\n\n| Option                             | Default         | Description                                                                                                                                           |\n|------------------------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `hostname`                         | Required        | Base URL for absolute links. This is required for generating fully qualified URLs in the sitemap.                                                     |\n| `cache`                            | `false`         | Cache configuration for the sitemap. Can be a boolean (enable/disable) or an object with duration and enabled flags.                                  |\n| `cache.duration`                   | `86400` (1 day) | Cache duration in seconds for storing the generated sitemap.                                                                                          |\n| `cache.enabled`                    | `false`         | If `true`, caching of the generated sitemap will be enabled.                                                                                          |\n| `collections`                      | `{}`            | Collection-specific configuration for the sitemap. Each key corresponds to a collection slug, and custom options can be provided for that collection. |\n| `collections.[key]`                | -               | Settings for a specific collection in the sitemap. If set to `true`, it includes all documents in that collection with default settings.              |\n| `collections.[key].changeFreq`     | -               | Frequency at which pages in this collection are expected to change. Can be overridden for each document.                                              |\n| `collections.[key].includeDrafts`  | `false`         | If `true`, drafts for this collection will be included in the sitemap.                                                                                |\n| `collections.[key].lastModField`   | -               | Custom field to determine the last modified date (`lastmod`) for documents in the collection.                                                         |\n| `collections.[key].priority`       | -               | Default priority for documents in this collection. Can be between 0.0 and 1.0.                                                                        |\n| `collections.[key].fieldOverrides` | -               | Function to override or extend the default fields (`sitemapPriority` and `excludeFromSitemap`) for this collection. Returns a new array of fields.    |\n| `customRoutes`                     | -               | Custom routes to include in the sitemap with their own configuration (change frequency, last modified date, priority).                                |\n| `defaultPriority`                  | `0.5`           | Default priority for all documents in the sitemap. Values range from 0.0 (lowest) to 1.0 (highest).                                                   |\n| `disabled`                         | `false`         | If set to `true`, disables the sitemap plugin.                                                                                                        |\n| `generateURL`                      | -               | Custom function to generate URLs for documents in this collection.                                                                                    |\n| `includeDrafts`                    | `false`         | If `true`, includes drafts in the sitemap. This is overridden by individual collection settings.                                                      |\n| `includeHomepage`                  | `true`          | If `true`, includes a default `/` entry in the sitemap.                                                                                               |\n| `globalOverrides`                  | `true`          | Function to override or extend fields on the sitemap global used for caching. Returns a new array of fields.                                          |\n\n## TODO\n\n- Add localisation, ability to specify alternate pages: `\u003cxhtml:link rel=\"alternate\"\u003e`\n- Allow `limit` and sitemaps greater than 45,000.\n\n## Contributing\n\nContributions are welcome! If you find any bugs or have suggestions for improvement, please open an\nissue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Trademark\n\nainsley.dev and the ainsley.dev logo are either registered trademarks or trademarks of ainsley.dev\nLTD in the United Kingdom and/or other countries. All other trademarks are the property of their\nrespective owners.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleyclark%2Fpayload-sitemap-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fainsleyclark%2Fpayload-sitemap-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleyclark%2Fpayload-sitemap-plugin/lists"}