A Node.js package that scans a HTML file and shows all of the SEO defects specified by the user.
- Node
- npm
npm install seo-detect
const seoDetect = require('seoDetect');
// specify input, rule and output file paths
seoDetect.getResults({
inputFilePath: 'path/to/input/file',
ruleFilePath: 'path/to/rule/file',
outputFilePath: 'path/to/output/file',
});
Three formats are allowed:
<tag_name>
exists or<tag_name attribute>
exists<tag_name>
withoutattribute
<tag_name>
limitnumber
There are five default rules specified:
1. <img> without alt
2. <a> without rel
3. In <head>:
<title> exists
<meta name="description"> exists
<meta name="keywords"> exists
4. <strong> limit 15
5. <h1> limit 1
If you want to add/remove rules, you can either edit the seo-detect/test_files/rule.txt
file or specify your own rule file path.
After cloning the repo and installing the modules, run npm run test
with or without arguments.
Use a module like minimist to accept input from the user. An example can be found at test.js
This project is licensed under the MIT License - see the LICENSE file for details