How to use the sitemapper function in sitemapper

To help you get started, we’ve selected a few sitemapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seantomburke / sitemapper / example.es6.js View on Github external
import Sitemapper from 'sitemapper';

const sitemapper = new Sitemapper();

const Google = new Sitemapper({
  url: 'https://www.google.com/work/sitemap.xml',
  timeout: 15000, // 15 seconds
});

Google.fetch()
  .then(data => console.log(data.sites))
  .catch(error => console.log(error));

sitemapper.timeout = 5000;

sitemapper.fetch('http://wp.seantburke.com/sitemap.xml')
  .then(({ url, sites }) => console.log(`url:${url}`, 'sites:', sites))
  .catch(error => console.log(error));

sitemapper.fetch('http://www.cnn.com/sitemaps/sitemap-index.xml')
  .then(data => console.log(data))
github seantomburke / sitemapper / example.es6.js View on Github external
import Sitemapper from 'sitemapper';

const sitemapper = new Sitemapper();

const Google = new Sitemapper({
  url: 'https://www.google.com/work/sitemap.xml',
  timeout: 15000, // 15 seconds
});

Google.fetch()
  .then(data => console.log(data.sites))
  .catch(error => console.log(error));

sitemapper.timeout = 5000;

sitemapper.fetch('http://wp.seantburke.com/sitemap.xml')
  .then(({ url, sites }) => console.log(`url:${url}`, 'sites:', sites))
  .catch(error => console.log(error));

sitemapper

Parser for XML Sitemaps to be used with Robots.txt and web crawlers

MIT
Latest version published 5 months ago

Package Health Score

69 / 100
Full package analysis

Popular sitemapper functions