robots-txt-guard

Validate urls against robots.txt rules.

MIT 8 个版本
安装
npm install robots-txt-guard
yarn add robots-txt-guard
pnpm add robots-txt-guard
bun add robots-txt-guard
README

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
版本列表
1.0.2 2021-02-08
1.0.1 2021-02-07
1.0.0 2021-02-07
0.2.1 2017-12-04
0.1.1 2017-11-29
0.1.0 2014-12-07
0.0.2 2014-10-29
0.0.1 2014-10-14