robots-txt-guard
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');
robotsTxt.isAllowed('mozilla', '/tmp/abc');
robotsTxt.isAllowed('googlebot-news', '/home.html');
robotsTxt.isIndexable('googlebot', '/tmp/*');
robotsTxt.isIndexable('googlebot', '/temporary/*');