All Projects → schneidmaster → sitemap-webpack-plugin

schneidmaster / sitemap-webpack-plugin

Licence: MIT license
Webpack plugin to generate a sitemap.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to sitemap-webpack-plugin

Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+1600%)
Mutual labels:  sitemap
Craft Seomatic
SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
Stars: ✭ 135 (+87.5%)
Mutual labels:  sitemap
Sitemap
Google sitemap builder for Laravel
Stars: ✭ 243 (+237.5%)
Mutual labels:  sitemap
Sitemap
Sitemap is the easiest way to generate Sitemaps in Elixir.
Stars: ✭ 90 (+25%)
Mutual labels:  sitemap
Craft Sitemap
Craft plugin to generate a sitemap.
Stars: ✭ 105 (+45.83%)
Mutual labels:  sitemap
Sitemap Generator Crawler
Script that generates a sitemap by crawling a given URL
Stars: ✭ 169 (+134.72%)
Mutual labels:  sitemap
Dctb Links
My Personal Links
Stars: ✭ 65 (-9.72%)
Mutual labels:  sitemap
webpack-bugsnag-plugins
Webpack plugins for common Bugsnag actions.
Stars: ✭ 29 (-59.72%)
Mutual labels:  webpack-plugin
Sitemap
PHP XML Sitemap Generation
Stars: ✭ 128 (+77.78%)
Mutual labels:  sitemap
Sitemap Generator Cli
Creates an XML-Sitemap by crawling a given site.
Stars: ✭ 214 (+197.22%)
Mutual labels:  sitemap
Laravel Sitemap
Create and generate sitemaps with ease
Stars: ✭ 1,325 (+1740.28%)
Mutual labels:  sitemap
Vue Router Sitemap
Generate sitemap.xml by vue-router configuration
Stars: ✭ 102 (+41.67%)
Mutual labels:  sitemap
React Router Sitemap
Generate sitemap.xml by React Router configuration
Stars: ✭ 189 (+162.5%)
Mutual labels:  sitemap
Laravel Sitemap
Laravelium Sitemap generator for Laravel.
Stars: ✭ 1,231 (+1609.72%)
Mutual labels:  sitemap
Python Sitemap
Mini website crawler to make sitemap from a website.
Stars: ✭ 246 (+241.67%)
Mutual labels:  sitemap
Sitemap.js
Sitemap-generating framework for node.js
Stars: ✭ 1,159 (+1509.72%)
Mutual labels:  sitemap
Go Sitemap Generator
go-sitemap-generator is the easiest way to generate Sitemaps in Go
Stars: ✭ 152 (+111.11%)
Mutual labels:  sitemap
webpack-extract-translation-keys
This plugin extracts translation keys for applications requiring runtime translations
Stars: ✭ 35 (-51.39%)
Mutual labels:  webpack-plugin
nunjucks-webpack-plugin
A webpack plugin for nunjucks.
Stars: ✭ 27 (-62.5%)
Mutual labels:  webpack-plugin
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+191.67%)
Mutual labels:  sitemap

npm version CircleCI Coverage Status

sitemap-webpack-plugin

Webpack plugin to generate a sitemap from a list of paths.

Installation

npm install sitemap-webpack-plugin --save-dev

For webpack 4 or 5, use the latest version. For webpack <= 3, use version 0.5.x.

Usage

Add to your webpack config -- see below for examples. The plugin signature is:

new SitemapPlugin({ base, paths, options })
  • base is the root URL of your site (e.g. https://mysite.com)
  • 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.
  • options is an optional object of top-level configuration settings.

Options

The following options may be provided in the options argument to the plugin constructor. This library uses the sitemap package under the hood, so you can also provide any other options that sitemap supports.

Name Type Default Description
filename string sitemap.xml Name of the sitemap file emitted to your build output
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.)
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.
lastmod string / boolean false The date value for <lastmod> 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.
priority number undefined A <priority> to be set globally on all locations. Can be overridden by path-specific priority.
changefreq string undefined A <changefreq> to be set globally on all locations; list of applicable values based on sitemaps.org: always, hourly, daily, weekly, monthly, yearly, never. Can be overridden by path-specific changefreq.

Path-specific options

If 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 package under the hood, so you can also provide any other options that sitemap supports.

Name Type Default Description
path (required) string N/A The URL path, e.g. /some/page
lastmod string false The date value for <lastmod> -- when this path was last modified.
priority number undefined A numerical <priority> to be set on the path.
changefreq string undefined The <changefreq> to be set on the path; list of applicable values based on sitemaps.org: always, hourly, daily, weekly, monthly, yearly, never.

Example webpack.config.js

const SitemapPlugin = require('sitemap-webpack-plugin').default;

// Example of simple string paths
const paths = [
  '/foo/',
  '/bar/'
];

// Example of object paths
// Object paths must have a `path` attribute -- others are optional,
// and fall back to global config (if any)
const paths = [
  {
    path: '/foo/',
    lastmod: '2015-01-04',
    priority: 0.8,
    changefreq: 'monthly'
  },
  {
    path: '/bar/',
    lastmod: '2018-02-05',
    priority: 0.5,
    changefreq: 'yearly'
  }
];

// Example webpack configuration -- input/output/etc. omitted for brevity.
export default {
  // Basic usage (output defaults to sitemap.xml)
  plugins: [
    new SitemapPlugin({ base: 'https://mysite.com', paths })
  ]

  // With custom output filename
  plugins: [
    new SitemapPlugin({
      base: 'https://mysite.com',
      paths,
      options: {
        filename: 'map.xml'
      }
    })
  ]

  // Skip generating a gzipped version of the sitemap
  plugins: [
    new SitemapPlugin({
      base: 'https://mysite.com',
      paths,
      options: {
        skipgzip: true
      }
    })
  ]

  // With global options
  plugins: [
    new SitemapPlugin({
      base: 'https://mysite.com',
      paths,
      options: {
        filename: 'map.xml',
        lastmod: true,
        changefreq: 'monthly',
        priority: 0.4
      }
    })
  ]
};

Contributing

  1. Fork the repository (https://github.com/schneidmaster/sitemap-webpack-plugin/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].