How to use the sitemapper.getSites 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 ericluwj / grunt-prerender / tasks / prerender.js View on Github external
var sitePath = options.sitePath;

    grunt.log.writeln('Prerendering ...');

    var snapshotOptions = {
      phantomScript: options.phantomScript,
      timeout: options.timeout,
      selector: options.selector,
      interval: options.interval
    };

    if (options.sitemap) {
      var urlObj = require('url').parse(options.sitemap);
      sitePath = urlObj.protocol + '//' + urlObj.host;

      require('sitemapper').getSites(options.sitemap, function(err, urls) {
        if (err) {
          var urls = options.urls;
        }
        urls = urls.map(function(url) {
          return require('url').parse(url).pathname;
        });
        crawlUrls(urls);
      });
    } else {
      // strip site path of trailing slash
      if (sitePath[sitePath.length-1] === '/') sitePath = sitePath.slice(0, -1);

      var urls = options.urls;
      crawlUrls(urls);
    }

sitemapper

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

MIT
Latest version published 9 days ago

Package Health Score

83 / 100
Full package analysis

Popular sitemapper functions