gxs

grunt-xml-sitemap

⚠️ [deprecated - see https://github.com/LotusTM/grunt-sitemap-xml]

Showing:

Popularity

Downloads/wk

27

GitHub Stars

3

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

3

Size (min+gzip)

0.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

grunt-xml-sitemap

NPM Version Build Status

Grunt plugin for generating XML sitemaps for search engine indexing.

Getting Started

This plugin requires Grunt.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-xml-sitemap --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-xml-sitemap');

The 'xml_sitemap' task

Overview

In your project's Gruntfile, add a section named xml_sitemap to the data object passed into grunt.initConfig().

grunt.initConfig({
  xml_sitemap: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.changefreq

Type: String Default value: 'weekly'

A string value that is used to defined the change frequency.

options.dest

Type: String Default value: 'tmp/'

A string value that is used to define the output directory.

options.fileName

Type: String Default value: 'sitemap'

A string value that is used to define the filename (outputs sitemap.xml).

options.siteRoot

Type: String Default value: 'pkg.homepage'

A string value that is used to define the site root of the URL. Defaults to homepage from package.json.

options.stripIndex

Type: Bool Default value: true

A boolean value that is used to determine whether to strip index.html from the URL.

options.lastMod

Type: String Default value: grunt.template.today('yyyy-mm-dd\'T\'HH:MM:ss.000\'Z\'')

A string value that is used to define the last modified date. Defaults to current date using grunt.template.today( ).

options.priority

Type: String Default value: '0.5'

A string value that is used to define the priority.


Usage Examples

Default Options

In this example, the default options are used to generate the XML sitemap.

grunt.initConfig({
  xml_sitemap: {
    default_options: {
      files: [
        {
          expand: true,
          cwd: 'src/',
          src: [
            '**/*.html'
          ]
        }
      ]
    }
  }
});

Custom Options

In this example, custom options are used to generate the XML sitemap.

grunt.initConfig({
  xml_sitemap: {
    custom_options: {
      options: {
        changefreq: 'weekly',
        dest: 'tmp/',
        fileName: 'sitemap-custom',
        siteRoot: 'http://daniel.furzeface.com/',
        lastMod: '2014-10-18T09:54:31.000Z',
        priority: '0.8'
      },
      files: [
        {
          expand: true,
          cwd: 'src/',
          src: [
            '**/*.html',
            '!docs/**/*.html'
          ]
        }
      ]
    }
  }
});

Contributing

Build Status devDependency Status Stories in Ready

To contribute either check the Waffle board or GitHub issues then work away:

  1. Fork it!
  2. Create your feature branch: git checkout -b feature/awesome-feature
  3. Run: npm install for dependencies and npm link for local development
  4. Run: grunt develop to build and watch for changes
  5. Commit your changes: git commit -m 'feat(Project): Adds awesome feature'
  6. Push to the branch: git push origin feature/awesome-feature
  7. Submit a pull request 👍

Tips:

  • In lieu of a formal styleguide, take care to maintain the existing coding style.
  • Add unit tests for any new or changed functionality.
  • Test your code using Grunt: grunt test
  • Install editorconfig-sublime for Sublime Text to help with consistent code formatting.
  • Commit messages loosely adhere to these guidelines.
  • Versioning adheres to Semver.

Release History

  • 2014-10-18 v0.1.1 - Adds support for stripping index.html if required.
  • 2014-10-18 v0.1.0 - Initial release.

NPM

License

Copyright (c) 2014 Daniel Furze.

Licensed under the MIT license: http://danielfurze.mit-license.org

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100