0.0.2 • Published 7 years ago

seo-verify v0.0.2

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

Requirements

  • Node >= 8.0, npm >= 5.0

How to use this library

Write your own seo rules

  • By default this library came with basic seo rules as the following snippet:
    [
      rule('img', attrs => !attrs.alt, '<img /> missing alt'),
      rule('a', attrs => !attrs.rel, '<a /> missing rel'),
      rule('head meta', countLessThan(1)(attrs => attrs.name === 'description'), '<meta name="description" /> not found'),
      rule('head meta', countLessThan(1)(attrs => attrs.name === 'keywords'), '<meta name="keywords" /> not found'),
      rule('strong', countMoreThan(15)(() => true), '<strong> use more than 15 times'),
      rule('h1', countMoreThan(1)(() => true), '<h1> use more than 1 time'),
      rule('title', countLessThan(1)(() => true), '<title> not found'),
    ]
  • A seo rule will need: 1) A html tag or css element element selector 2) Capture function for catching seo issue
    if you just need to validate the tag exits just put a function that return true 3) A message to print out seo issues on your console.
  • Example for adding new rule:
    const {seoVerify , defaultRules, rule, countLessThan} = require('seo-verify');
    seoVerify(defaultRules.concat([
      rule('head meta', countLessThan(1)(attrs => attrs.name = 'robot'), '<meta name="robot" /> not found')
      // more rules...
    ]))