npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

htmlseoscan

v1.0.2

Published

A Node.js package to let user can use this package to scan a HTML file and show all of the SEO defects.

Downloads

8

Readme

htmlSEOscan

A Node.js package to let user can use this package to scan a HTML file and show all of the SEO defects.

A NPM module

npm install htmlseoscan

The detail see the test.js file.

const { htmlCheck, FileInput, StreamInput, ConsoleOutput, FileOutput, StreamOutput } = require('htmlseoscan')

HTML input

I. A HTML file (User is able to config the input path)

const FileInput = require('htmlseoscan')
const InputPath = '/yourpath/filename' // input local file path 
const input = new FileInput(InputPath)

II. Node Readable Stream

const fs = require('fs')
const StreamInput = require('htmlseoscan')
const readstream = fs.createReadStream(filePath)
const input = new StreamInput(readstream)

Result output

I. A file (User is able to config the output destination)

const FileOutput = require('htmlseoscan')
const outputPath = '/yourpath/outputfilename' 
const output = new FileOutput(outputPath)

II. Node Writable Stream

const fs = require('fs')
const StreamOutput = require('htmlseoscan')
const writestream = fs.createWriteStream(filePath)
const output = new StreamOutput(writestream)

III. Console

const fs = require('fs')
const ConsoleOutput = require('htmlseoscan')
const output = new ConsoleOutput()

Pre-defined SEO rules

const htmlCheck = require('htmlseoscan')
const htmlSEOcheck = new htmlCheck()
htmlSEOcheck.setInput(input)
htmlSEOcheck.setOutput(output)
htmlSEOcheck.run().then(function(result){
         htmlSEOcheck.getResult()
})
  1. Detect if any <img /> tag without alt attribute
htmlSEOcheck.selectdefaultRule([1])
  1. Detect if any <a /> tag without rel attribute
htmlSEOcheck.selectdefaultRule([2])
  1. 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
htmlSEOcheck.selectdefaultRule([3])
  1. Detect if there’re more than 15 <strong> tag in HTML (15 is a value should be configurable by user)
htmlSEOcheck.selectdefaultRule([4])

// const CheckTagCount = require('htmlseoscan')
// htmlSEOcheck.CustomerRule([new CheckTagCount('', 'strong', 15)])
  1. Detect if a HTML have more than one <H1> tag.
htmlSEOcheck.selectdefaultRule([5])

// const CheckTagCount = require('htmlseoscan')
// htmlSEOcheck.CustomerRule([new CheckTagCount('', 'h1', 1)])

Example Output

  1. they can only use the rule 1 and 4.
const { htmlCheck, FileInput, ConsoleOutput} = require('htmlseoscan')
const InputPath = __dirname + '/test.html' // input local file path 
const input = new FileInput(InputPath)
const output = new ConsoleOutput() // ouput in Console.

htmlSEOcheck.setInput(input)
htmlSEOcheck.setOutput(output)
htmlSEOcheck.selectdefaultRule([1, 4])

htmlSEOcheck.run().then(function(result){
         htmlSEOcheck.getResult()
})
  1. Checking existing or not?
const { htmlCheck, FileInput, ConsoleOutput, FileOutput, CheckTagNoAttrValu } = require('htmlseoscan')

const InputPath = __dirname + '/test.html' // input local file path 
const input = new FileInput(InputPath)

const output = new ConsoleOutput() // ouput in Console.

const htmlSEOcheck = new htmlCheck(false)
htmlSEOcheck.setInput(input)
htmlSEOcheck.setOutput(output)
//Checking <meta name=“robots” /> existing or not
htmlSEOcheck.CustomerRule([new CheckTagNoAttrValue('head', 'meta', 'name', 'robots')])
htmlSEOcheck.run().then(function(result){
         htmlSEOcheck.getResult()
})

//SEO defects found:
//This HTML without <meta name="robots"> tag.
  1. Showing all of the defects for rules that user apply, following is a simple output demo when a user apply above 5 rules.
const { htmlCheck, FileInput, ConsoleOutput} = require('htmlseoscan')
const InputPath = __dirname + '/test.html' // input local file path 
const input = new FileInput(InputPath)
const output = new ConsoleOutput() // ouput in Console.

htmlSEOcheck.setInput(input)
htmlSEOcheck.setOutput(output)

htmlSEOcheck.run().then(function(result){
         htmlSEOcheck.getResult()
})

User can define and use their own rules easily.

Please follow this check rule structure:

const CheckRule  = require('htmlseoscan')

class NewCheckRule extends CheckRule {
	constructor(rootag, parameters...) {
		super(rootag)
	     	...
	   }

	check() {
		// check rule
	 	this.isCheck = true // or false
	   }

	err() {
		return !this.isCheck ? "Error message" : ""
	} 
}

Then, add this rule in htmlCheck function. ex:htmlSEOcheck.CustomerRule([new NewCheckRule(rootag, parameters...)])