Submits/pings sitemap files to Google and Bing in Node.js.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

submit-sitemap module for Node.js

Travis CI build status Version badge

Module to submit/ping a sitemap XML file to Google and Bing. This automates the manual process of submitting your sitemap via Google's webmaster tools and Bing's webmaster tools.

Use this after your site content has changed to encourage search engines to recrawl your site for Search Engine Optimisation (SEO) purposes. For example, this is useful to do after deploying a site update in Grunt and Gulp scripts.

If you're looking for modules to generate sitemaps, you may want to consider grunt-sitemap for Grunt and gulp-sitemap for Gulp.

Usage

To install:

npm install submit-sitemap --save-dev

To submit your sitemap:

var submitSitemap  = require('submit-sitemap').submitSitemap;
var yourSitemapUrl = "http://www.google.com/sitemap.xml";

submitSitemap(yourSitemapUrl);

Use the callback parameter to respond to success and failure:

submitSitemap(yourSitemapUrl,  function(err) { console.error(err); });
  • On success, err will be undefined.

  • On error, err will be set to an error message. This happens if the sitemap URL could not be reached or any of the sitemap submission attempts failed.

Tests

To run the test suite:

npm test

License

MIT

Author

Written by Sean Wilson (sw@seanw.org).