1.0.4 • Published 5 years ago
@reginleiff/seo-defect-checker v1.0.4
SEO Defect Checker
Detect Search Engine Optimisation (SEO) defects within HTML code.
Installation
$ npm i @reginleiff/seo-defect-checkerUsage
Using it as a CLI Tool
- -i- Input file path for html file
- -r- Rule set export (see- lib/sample-rules.jsas an example)
- -o- Output file path (optional -- consolewill be used otherwise)
$ seocheck -i examples/sample.html -r ./lib/sample-rules.js -o ./examples/sample-out.txtUsing the check API
import { check, PredefinedRules } from '@reginleiff/seo-defect-checker';
await check('./test.html', [
  PredefinedRules.ReportNumberImgTagsWithoutRelAttribute,
  PredefinedRules.HeaderShouldContainsTitle,
  PredefinedRules.ReportIfNotMoreThan15Strong
], console);Creating your own rules
// rules.js
import { ParentContainsTagRule } from '@reginleiff/seo-defect-checker';
const ShouldContainMetaNameRobots = new ParentContainsTagRule('meta', ['name'], ['robots']);
export default {
  ShouldContainMetaNameRobots
}