npm

Need private packages and team management tools?Check out npm Orgs. »

sitemap

0.5.0 • Public • Published

sitemap.js

sitemap.js is a high-level sitemap-generating framework that makes creating sitemap XML files easy.

Installation

It's recommended to install via npm:

npm install -g sitemap

Usage

Here's an example of using sitemap.js with express:

var express = require('express')
  , sm = require('sitemap');

var app = express.createServer()
  , sitemap = sm.createSitemap ({
      hostname: 'http://example.com',
      cacheTime: 600000,  // 600 sec cache period
      urls: [
        { url: '/page-1/',  changefreq: 'dayly', priority: 0.3 },
        { url: '/page-2/',  changefreq: 'monthly',  priority: 0.7 },
        { url: '/page-2/' } // changefreq: 'weekly',  priority: 0.5
      ]
    });

app.get('/sitemap.xml', function(req, res) {
  res.header('Content-Type', 'application/xml');
  res.send( sitemap.toXML() );
});

app.listen(3000);

License

See LICENSE file.

install

npm i sitemap

Downloadsweekly downloads

144,283

version

0.5.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability