simple-seolint
v0.1.3
Published
SEO lint node.js module
Readme
simple-seolint
A simple SEO lint npm module.
Installation
npm install simple-seolintGetting Started
Console Input/Console Output
// load html content
var seolint = require('./seolint.js');
var content = '<html>simple html</html>';
seolint.load(content, function(error, data) {
seolint.check(data).outConsole();
});File Input/File Output
// load html content from file
seolint.loadFile('sample.html', function(error, data) {
seolint.check(data, {'checkH1Limit': true, 'checkHead': true, 'checkStrongLimit': true}).outFile('file_result');
});Stream Input/Stream Output
// load html content from readable stream
var fs = require('fs');
var rs = fs.createReadStream('test.html');
var ws = fs.createWriteStream('stream_result');
rs.setEncoding('utf8');
seolint.loadStream(rs, function(error, data) {
seolint.check(data, {'checkH1Limit': true, 'checkHead': true, 'checkStrongLimit': true, 'strongLimit': 1}).outStream(ws);
});Rules Configuration
Pre-defined rules that detect defects as below:
- <img /> tag without alt attribute
- <a /> tag without rel attribute
- In <head> tag
- it doesn’t have <title> tag
- it doesn’t have tag
- it doesn’t have tag
- more than N <strong> tag (N default value = 15)
- more than one <h1> tag
// if no config parameter passed, check() will apply default rule config as below
// {'checkImg': true, 'checkAnchorRel': true, 'checkHead': true, 'checkStrongLimit': true, 'strongLimit': 15, 'checkH1Limit': true,}
seolint.load(content, function(error, data) {
seolint.check(data).outConsole();
});
Output Example
> node example
<img /> tag without alt attribute
<a /> tag without rel attribute
header doesn't have <title> or <meta name="description"> or <meta name="keywords">
<strong /> more than 15
more than one <h1 />
