Vasily Ivanov Vasily Ivanov - 7 months ago 17
Node.js Question

Node.js : Using sitemaps for virtual hosts (vhost)

I'm a beginner with node.js.
Currently I'm using node.js + express + vhost to host different domains like, etc.

How can I provide a different sitemap for each domain ( , ?

I see this sitemap-generating framework : sitemap which is not bad actually but I can't figure out how to use it with virtual hosts.

And the same question for robots.txt files for each domain.


Ok, I get it. sitemap.js do the trick. My code:

const sm = require('sitemap');
const sitemap = sm.createSitemap({
    hostname: 'http://' +,
    cacheTime: 600000
    url: '/page1',
    changefreq: 'weekly',
    priority: 1.0

res.header('Content-Type', 'application/xml');