@charlesy77/seo_defects

Scan a HTML file and show all of the SEO defects

Usage no npm install needed!

<script type="module">
  import charlesy77SeoDefects from 'https://cdn.skypack.dev/@charlesy77/seo_defects';
</script>

README

@charlesy77/seo_defects

Scan a HTML file and show all of the SEO defects

Pre-defined SEO rules:
1. Detect if any <img /> tag without alt attribute
2. Detect if any <a /> tag without rel attribute
3. In <head> tag
   i. Detect if header doesn’t have <title> tag
   ii. Detect if header doesn’t have <meta name=“descriptions” ... /> tag
   iii. Detect if header doesn’t have <meta name=“keywords” ... /> tag
4. Detect if there’re more than 15 <strong> tag in HTML (15 is a value should be configurable by user)
5. Detect if a HTML have more than one <H1> tag.

Usage

// Import the module
var seo_defects = require('@charlesy77/seo_defects');

// Rules can be chained in any order.
var Detector = new seo_defects.r1(
    new seo_defects.r2(
        new seo_defects.r3(
            new seo_defects.r4(
                new seo_defects.r5(),
                {limit: 15}  // Rule specifed config is given if necessary.
            )
        )
    )
);

// Input from file and output to console
Detector.scan(
    new seo_defects.reader(sample_html_path),
    new seo_defects.writter()
);

// Input from file and output to file
Detector.scan(
    new seo_defects.reader(sample_html_path),
    new seo_defects.writter(resut_path_1)
);

// Input from file and output to stream
Detector.scan(
    new seo_defects.reader(sample_html_path),
    new seo_defects.writter(fs.createWriteStream(resut_path_2)
);

// Input from stream and output to stream
Detector.scan(
    new seo_defects.reader(fs.createReadStream(sample_html_path)),
    new seo_defects.writter(fs.createWriteStream(resut_path_2))
);

// Input from stream and output to file
Detector.scan(
    new seo_defects.reader(fs.createReadStream(sample_html_path)),
    new seo_defects.writter(resut_path_2)
);

outputs

There are 2 <a> tags without rel attribute.
This HTML without <title> tag
This HTML without <meta> tag named "descriptions"
This HTML without <meta> tag named "keywords"

Install

With npm installed, run

$ npm install @charlesy77/seo_defects

License

ISC