Webpack plugin to generate a sitemap. Designed to work with static-site-generator-webpack-plugin.
npm install sitemap-webpack-plugin --save-dev
Add to your webpack config -- see below for an example. The plugin signature is:
new SitemapPlugin(base, paths, filename)
baseis the root URL of your site (e.g. 'https://mysite.com')pathsis the array of locations on your site -- this can be the same one you pass tostatic-site-generator-webpack-pluginfilenameis the name of the output file -- the default issitemap.xml
lastMod[boolean] defaultfalsepriority[number] defaultnullchangeFreq[string] defaultnull, list of applicable values based on sitemaps.org
always
hourly
daily
weekly
monthly
yearly
never
var SitemapPlugin = require('sitemap-webpack-plugin');
var paths = [
'/foo/',
'/bar/'
];
module.exports = {
/* snip */
plugins: [
new SitemapPlugin('https://mysite.com', paths, 'map.xml')
]
/* with options */
plugins: [
new SitemapPlugin(
'https://mysite.com',paths, 'map.xml',
{
lastMod: true,
changeFreq: 'monthly',
priority: 0.4,
}
)
]
};- Fork it ( https://github.com/schneidmaster/sitemap-webpack-plugin/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request