Detect Search Engine Optimisation (SEO) defects within HTML code.
$ npm i @reginleiff/seo-defect-checker
Create your own rules file to detect desired SEO defects.
// myrules.js
import { ParentContainsTagRule } from '@reginleiff/seo-defect-checker';
const ShouldContainMetaNameRobots = new ParentContainsTagRule('meta', ['name'], ['robots']);
export default {
ShouldContainMetaNameRobots
}
Utilise your rules with the CLI tool or the check
API.
$ seocheck -i target-file.html -r myrules.js -o report.txt
-i
- Input file path for html file-r
- Rule set export (seelib/sample-rules.js
as an example)-o
- Output file path (optional -console
will be used otherwise)
$ seocheck -i examples/sample.html -r ./lib/sample-rules.js -o ./examples/sample-out.txt
See examples/sample-out.txt
for the result report.
import { check, PredefinedRules } from '@reginleiff/seo-defect-checker';
await check('./test.html', [
PredefinedRules.ReportNumberImgTagsWithoutRelAttribute,
PredefinedRules.HeaderShouldContainsTitle,
PredefinedRules.ReportIfNotMoreThan15Strong
], console);