sitemap-xml

Create a sitemap.xml file by streaming URLs

npm install sitemap-xml
1 downloads in the last week
44 downloads in the last month

sitemap.xml

Stream URLs to the sitemap.

Build Status

Usage

var sitemap = require('sitemap-xml');

// Raw node
var http = require('http');
http.createServer(function (request, response) {
    res.writeHead(200, {'Content-Type': 'application/xml'});
    var stream = sitemap();
    stream.pipe(response);
    stream.write({ loc: 'http://example.com/', lastmod: '2013-04-21' });
    stream.write({ loc: 'http://example.com/page-1', priority: '0.9' });
    stream.end();
})

// Express
app.get('/sitemap.xml', function(request, response, next) {
    var stream = sitemap();
    stream.pipe(response);
    stream.write({ loc: 'http://example.com/', lastmod: '2013-04-21' });
    stream.write({ loc: 'http://example.com/page-1', priority: '0.9' });
    stream.end();
});
npm loves you