Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
/ ssblc Public archive
forked from pklaschka/ssblc

Static Site Broken Link Chacker: A broken-link checker for static sites, like the ones generated with docsify

License

Notifications You must be signed in to change notification settings

waylayio/ssblc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@waylay/ssblc

Static Site Broken Link Checker

CI Status Badge

A broken-link checker for static sites, like the ones generated with docsify that can get used, for example, for CI purposes on docsify docs (this is what I've developed it for).

It recursively checks internal links found on the static website (until every internal link is checked) and (without recursion) outgoing links. This is achieved by finding href attributes in the HTML, meaning also stylesheets included with <link href="some-file.css"> get checked.

Installation

You can either run it by just using npx, in which case you won't have to install it, or first install it with

npm install -g @waylay/ssblc

Usage

When you are in the folder of your static website (i.e., there is an index.html in this folder), simply run

ssblc

after which the checker will begin its work.

To use it with npx, simply run

npx @waylay/ssblc

Alternatively, you can also specify an absolute or relative path to the directory of the site, e.g., like this:

ssblc --dir ../my-site

If not present, the checker will use the current working directory as the base directory.

Additional Options

--context [file]

Loads a JSON file with context variables for link replacement. The file should contain a JSON object with the following structure:

{
  "vars": {
    "some-key": "some-value",
    "another-key": "another-value"
  }
}

The context variables can be used in the href attributes of the HTML, e.g., <a href="{{vars.some-key}}">Some Link</a>.

--max-concurrent-checks [number]

Sets the maximum number of concurrent checks (default: 5).

--protocol-timeout [milliseconds]

Sets the protocol timeout for Puppeteer (default: 30000 ms).

--page-load-timeout [milliseconds]

Sets the page load timeout for Puppeteer (default: 30000 ms).

--port [number]

Sets the port number for the local server (default: 3000).

--ignore-statuses [statuses]

Comma-separated list of HTTP statuses to ignore (e.g., 401,403).

--dry-run

If present, exit with code 0 even if errors are found.

Examples

Check a static site in the current working directory

ssblc

Check a static site in a different directory

ssblc --dir ../my-site

Check a static site with context variables

ssblc --context context.json

Check a static site using a different port number

ssblc --port 8080

Check a static site using a different protocol timeout

ssblc --protocol-timeout 60000

Check a static site using a different page load timeout

ssblc --page-load-timeout 60000

Check a static site using a different maximum number of concurrent checks

ssblc --max-concurrent-checks 10

Check a static site with ignored HTTP statuses

ssblc --ignore-statuses 401,403

Check a static site and exit with code 0 even if errors are found

ssblc --dry-run

About

Static Site Broken Link Chacker: A broken-link checker for static sites, like the ones generated with docsify

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.4%
  • HTML 2.6%