{"id":20706272,"url":"https://github.com/schneidmaster/sitemap-webpack-plugin","last_synced_at":"2026-03-17T17:32:26.961Z","repository":{"id":5484595,"uuid":"53270746","full_name":"schneidmaster/sitemap-webpack-plugin","owner":"schneidmaster","description":"Webpack plugin to generate a sitemap.","archived":false,"fork":false,"pushed_at":"2023-01-04T21:49:50.000Z","size":1014,"stargazers_count":73,"open_issues_count":8,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T00:18:19.539Z","etag":null,"topics":["sitemap","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"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/schneidmaster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-06T18:58:13.000Z","updated_at":"2024-04-02T17:40:58.000Z","dependencies_parsed_at":"2023-01-13T15:30:29.229Z","dependency_job_id":null,"html_url":"https://github.com/schneidmaster/sitemap-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneidmaster%2Fsitemap-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneidmaster%2Fsitemap-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneidmaster%2Fsitemap-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneidmaster%2Fsitemap-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schneidmaster","download_url":"https://codeload.github.com/schneidmaster/sitemap-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131318,"owners_count":21052820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["sitemap","webpack","webpack-plugin"],"created_at":"2024-11-17T01:22:17.079Z","updated_at":"2026-03-17T17:32:21.901Z","avatar_url":"https://github.com/schneidmaster.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/sitemap-webpack-plugin.svg)](https://badge.fury.io/js/sitemap-webpack-plugin) [![CircleCI](https://circleci.com/gh/schneidmaster/sitemap-webpack-plugin.svg?style=shield)](https://circleci.com/gh/schneidmaster/sitemap-webpack-plugin) [![Coverage Status](https://coveralls.io/repos/github/schneidmaster/sitemap-webpack-plugin/badge.svg)](https://coveralls.io/github/schneidmaster/sitemap-webpack-plugin)\n\n# sitemap-webpack-plugin\n\nWebpack plugin to generate a sitemap from a list of paths.\n\n## Installation\n\n    npm install sitemap-webpack-plugin --save-dev\n\nFor webpack 4 or 5, use the latest version. For webpack \u003c= 3, use version 0.5.x.\n\n## Usage\n\nAdd to your webpack config -- see below for examples. The plugin signature is:\n\n    new SitemapPlugin({ base, paths, options })\n\n* `base` is the root URL of your site (e.g. `https://mysite.com`)\n* `paths` is the array of locations on your site. These can be simple strings or you can provide objects if you would like to customize each entry; objects must have a `path` attribute and may have other attributes documented [below](#path-specific-options).\n* `options` is an optional object of top-level configuration settings.\n\n### Options\n\nThe following options may be provided in the `options` argument to the plugin constructor. This library uses the [sitemap](https://www.npmjs.com/package/sitemap) package under the hood, so you can also provide [any other options](https://www.npmjs.com/package/sitemap#example-of-most-of-the-options-you-can-use-for-sitemap) that `sitemap` supports.\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| `filename` | `string` | `sitemap.xml` | Name of the sitemap file emitted to your build output |\n| `skipgzip` | `boolean` | `false` | Whether to skip generating a gzipped `.xml.gz` sitemap. (By default, both an uncompressed and a compressed sitemap are generated -- the compressed version is generated at `sitemap.xml.gz`, or `[filename].gz` if the `filename` configuration option is set.) |\n| `formatter` | `function` | `undefined` | An optional function to format the generated sitemap before it is emitted (for example, if you'd like to pretty-print the XML). The provided function must accept one argument (the unformatted XML) and return the formatted XML as a string. For an example of pretty-printing configuration, see the [formatted test](https://github.com/schneidmaster/sitemap-webpack-plugin/blob/master/test/cases/formatted/webpack.config.ts). |\n| `lastmod` | `string` / `boolean` | `false` | The date value for `\u003clastmod\u003e` on all paths. Can be overridden by path-specific `lastmod` setting. If set to boolean `true`, the current date will be used for all paths; otherwise, the provided date string will be used. |\n| `priority` | `number` | `undefined` | A `\u003cpriority\u003e` to be set globally on all locations. Can be overridden by path-specific `priority`. |\n| `changefreq` | `string` | `undefined` | A `\u003cchangefreq\u003e` to be set globally on all locations; list of applicable values based on [sitemaps.org](http://www.sitemaps.org/protocol.html): `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `never`. Can be overridden by path-specific `changefreq`. |\n\n### Path-specific options\n\nIf you choose to provide the paths as an array of objects, the following attributes may be set on each path object. This library uses the [sitemap](https://www.npmjs.com/package/sitemap) package under the hood, so you can also provide [any other options](https://www.npmjs.com/package/sitemap#example-of-most-of-the-options-you-can-use-for-sitemap) that `sitemap` supports.\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| `path` (required) | `string` | N/A | The URL path, e.g. `/some/page` |\n| `lastmod` | `string` | `false` | The date value for `\u003clastmod\u003e` -- when this path was last modified. |\n| `priority` | `number` | `undefined` | A numerical `\u003cpriority\u003e` to be set on the path. |\n| `changefreq` | `string` | `undefined` | The `\u003cchangefreq\u003e` to be set on the path; list of applicable values based on [sitemaps.org](http://www.sitemaps.org/protocol.html): `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `never`. |\n\n### Example webpack.config.js\n\n```js\nconst SitemapPlugin = require('sitemap-webpack-plugin').default;\n\n// Example of simple string paths\nconst paths = [\n  '/foo/',\n  '/bar/'\n];\n\n// Example of object paths\n// Object paths must have a `path` attribute -- others are optional,\n// and fall back to global config (if any)\nconst paths = [\n  {\n    path: '/foo/',\n    lastmod: '2015-01-04',\n    priority: 0.8,\n    changefreq: 'monthly'\n  },\n  {\n    path: '/bar/',\n    lastmod: '2018-02-05',\n    priority: 0.5,\n    changefreq: 'yearly'\n  }\n];\n\n// Example webpack configuration -- input/output/etc. omitted for brevity.\nexport default {\n  // Basic usage (output defaults to sitemap.xml)\n  plugins: [\n    new SitemapPlugin({ base: 'https://mysite.com', paths })\n  ]\n\n  // With custom output filename\n  plugins: [\n    new SitemapPlugin({\n      base: 'https://mysite.com',\n      paths,\n      options: {\n        filename: 'map.xml'\n      }\n    })\n  ]\n\n  // Skip generating a gzipped version of the sitemap\n  plugins: [\n    new SitemapPlugin({\n      base: 'https://mysite.com',\n      paths,\n      options: {\n        skipgzip: true\n      }\n    })\n  ]\n\n  // With global options\n  plugins: [\n    new SitemapPlugin({\n      base: 'https://mysite.com',\n      paths,\n      options: {\n        filename: 'map.xml',\n        lastmod: true,\n        changefreq: 'monthly',\n        priority: 0.4\n      }\n    })\n  ]\n};\n```\n\n## Contributing\n\n1. Fork the repository (https://github.com/schneidmaster/sitemap-webpack-plugin/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new pull request\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschneidmaster%2Fsitemap-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschneidmaster%2Fsitemap-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschneidmaster%2Fsitemap-webpack-plugin/lists"}