sitemap-xml
v0.1.0
Published
Create a sitemap.xml file by streaming URLs
Downloads
54
Readme
sitemap.xml
Stream URLs to the sitemap.
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();
});