Skip to content

Validate urls against robots.txt rules.

License

Notifications You must be signed in to change notification settings

Woorank/robots-txt-guard

Repository files navigation

robots-txt-guard Build Status

Validate urls against robots.txt rules. Configure with output from robots-txt-parse

Usage

var guard = require('robots-txt-guard');

var robotsTxt = guard({
  groups: [{
    agents: [ '*' ],
    rules: [
      { rule: 'allow', path: '/' }
    ]
  }, {
    agents: [ 'googlebot', 'twitterbot' ],
    rules: [
      { rule: 'disallow', path: '/tmp/*' },
      { rule: 'disallow', path: '/temporary/*' },
      { rule: 'noindex', path: '/temporary/*' }
    ]
  }]
});

robotsTxt.isAllowed('Googlebot', '/tmp/abc'); // false
robotsTxt.isAllowed('mozilla', '/tmp/abc'); // true
robotsTxt.isAllowed('googlebot-news', '/home.html'); // true

robotsTxt.isIndexable('googlebot', '/tmp/*'); // true
robotsTxt.isIndexable('googlebot', '/temporary/*'); // false

About

Validate urls against robots.txt rules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published