This package has been deprecated

Author message:

Use the linkinator package instead: https://www.npmjs.com/package/linkinator

@commercetools-docs/broken-link-checker

2.1.0 • Public • Published

Docs Kit Broken Link Checker

This package provides an executable script that checks a statically built website on the file system for any broken internal or external links.

It's based on the excellent broken-link-checker library and is fully preconfigured.

The exit code is 1 if a broken link was found, otherwise zero. This way the command can be used directly in build scripts to have the build fail or pass.

Usage

Typical usage in a static generator based website project is to include it as a development dependency

yarn add --dev @commercetools-docs/broken-link-checker

and then run it inside the project directory

npx commercetools-broken-link-checker ./my-site-output-folder entrypoint1/ entrypoint2/hello.html

The first parameter is the path to the site folder, all following parameters are entrypoints to be crawled.

The first entrypoint (for example the second parameter) is also considered the root URL of the complete site. For instance, in the preceeding example links to / are redirected to /entrypoint1/.

The crawler follows all links from the entrypoint, so if you accidentally provide multiple entrypoints that indirectly link to each other, pages are tested multiple times. Entrypoints are tested independently as separate runs.

You can provide the command globally too via npm install -g @commercetools-docs/broken-link-checker

Options

The package uses cosmiconfig to load configuration options. The supported options are then passed to the underlying broken-link-checker. See here for a complete list of options.

THe configuration options can be expressed in different ways, for example:

  • a broken-link-checker property in your package.json
  • a broken-link-checker.config.js JS file
  • a .broken-link-checkerrc.json JSON file

In package.json

{
  "broken-link-checker": {
    "excludedKeywords": []
    // ...other options
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @commercetools-docs/broken-link-checker

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

8.74 kB

Total Files

6

Last publish

Collaborators

  • gabriele.antonini-ct
  • nkuehn
  • emmenko
  • commercetools-admin