@jahed/webpack-sitemap

Sitemap Generator for Webpack

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@jahed/webpack-sitemap
Minified + gzip package size for @jahed/webpack-sitemap in KB

Readme

webpack-sitemap

Travis npm Patreon Liberapay

Generate Sitemaps as part of your Webpack build.

Installation

# Yarn
yarn add --dev @jahed/webpack-sitemap

# NPM
npm install --save-dev @jahed/webpack-sitemap

Example

Here's how you might use this plugin in your webpack.config.js:

import { SitemapPlugin } from '@jahed/webpack-sitemap'

// ...
plugins: [
    //...
    new SitemapPlugin({
        basename: 'https://example.com',
        sitemapindex: {
            'app': {
                urlset: {
                    '/some/page': {
                        priority: 0.9
                    }
                }
            }
        },
        defaults: {
            sitemap: {
                lastmod: new Date().toISOString()
            },
            url: {
                lastmod: new Date().toISOString(),
                priority: 0.5,
                changefreq: 'daily'
            }
        }
    })
    //...
]
//...

This will generated the following:

<?xml version="1.0" encoding="UTF-8"?>
<!-- /sitemap.xml -->
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://example.com/sitemaps/app.xml</loc>
        <lastmod>2017-11-29T00:39:29.258Z</lastmod>
    </sitemap>
</sitemapindex>
<?xml version="1.0" encoding="UTF-8"?>
<!-- /sitemaps/app.xml -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://example.com/some/page</loc>
        <lastmod>2017-11-29T00:39:29.258Z</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.9</priority>
    </url>
</urlset>

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.