Skip to content

domiwei/seo_defects_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seo_defects_detector

This module is developed and maintained by Kewei Chen.

The goal of this module is to detect user defined SEO defects in a html text. Example of how to utilize this module to create rules and detect SEO defects is written in test.js. For quick start, run "npm test" to see the result and refer to "test.js" to help coding. Following is classes provide in this module.

Class Rule

For a html tag, define a rule with some defects to be detected.

Methods:

  • withoutAttribute(attr_name, attr_value)
  • anyThisTag()
  • withoutTag(tag_rule)
  • amountMoreThan(number_of_the_tag)

All the methods above provide fluent interface. That is, the returned value of any these methods is the object reference itself. Hence you can chain these methods in a more readable way.

Usage:

Create a rule to detect any <img> without alt attribute:

rule = createTagRule('img').anyThisTag().withoutAttribute('alt')

In <head>, check if <meta name='description> cannot be found:

rule = createTagRule('head').withoutTag(createTagRule(meta).withoutAttribute('name', 'description'))

Class SEODefectsDetector

Methods:

  • addRule(rule)
  • addRules(rule_list)
  • detectByFile(file_name, output_stream)
  • detectByStream(input_stream, outputstream)

Functions

In this module, it provides function to create instance of Rule and SEODefectsDetector.
  • createTagRule(tag_name)
  • createSEODefectsDetector()

Both of above functions do nothing but wrap the behavior of creating an object of the corresponding class. It just makes the code more readable.

About

SEO defects detector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published