Last active
May 19, 2020 19:32
-
-
Save t18n/26070caf9e4a495a6083b3d4b57ce623 to your computer and use it in GitHub Desktop.
[Generate sitemap with sitemap-generator] Javascript snippet for generating sitemap with sitemap-generator #javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install sitemap-generator first | |
const SitemapGenerator = require('sitemap-generator'); | |
// create generator | |
var generator = SitemapGenerator('http://localhost:8080/', { | |
maxDepth: 10, | |
filepath: 'src/sitemap.xml', | |
maxEntriesPerFile: 50000, | |
stripQuerystring: true | |
}); | |
// register event listeners | |
generator.on('done', () => { | |
console.log('-> Sitemap Generated'); | |
}); | |
// start the crawler | |
generator.start(); | |
// -> node Generate-site-map.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment