2.1.4 • Published 8 days ago

metalsmith-link-checker v2.1.4

Weekly downloads
11
License
GPL-3.0-or-later
Repository
github
Last release
8 days ago

metalsmith-link-checker

npm: version npm: downloads

Snyk: vulnerabilities codecov: coverage license

A Metalsmith plugin to check for local and remote broken links.

This plugin checks a number of different link types and protocols:

  • http: and https: remote links (with backoff and retry)
  • Local links (both relative and absolute)
  • facetime: and facetime-audio: phone numbers and email addresses
  • mailto: email links
  • sms: phone numbers
  • tel: phone numbers

If there are any broken or invalid links found, all of them will be printed to console and the Metalsmith build will stop.

Installation

npm install --save metalsmith-link-checker

JavaScript Usage

This plugin will cause a build error if any links are broken:

import Metalsmith from 'metalsmith';
import linkChecker from 'metalsmith-link-checker';

Metalsmith(__dirname)
    .use(linkChecker({
        // options here
    }))
    .build((err) => {
        if (err) {
            throw err;
        }
    });

Options

html.pattern (optional)

Type: string Default: "**/*.html"

A micromatch glob pattern to find HTML files.

html.tags (optional)

Type: object Default:

{
  "a": "href",
  "img": ["src", "data-src"],
  "link": "href",
  "script": "src"
}

An object of what tags and attributes to look for links in.

ignore (optional)

Type: string[] Default: []

An array of regular expressions of links to be ignored.

timeout (optional)

Type: number Default: 10000

The network timeout when checking external links, in milliseconds.

attempts (optional)

Type: number Default: 3

The number of times to attempt checking external links.

userAgent (optional)

Type: string Default: the top result from top-user-agents

The user agent to use when making network requests.

parallelism (optional)

Type: number Default: 100

The maximum number of async operations at a time.

Changelog

Changelog

2.1.4

8 days ago

2.1.3

1 month ago

2.1.2

2 months ago

2.1.1

3 months ago

2.1.0

3 months ago

2.0.4

3 months ago

2.0.3

4 months ago

2.0.2

5 months ago

2.0.1

5 months ago

1.0.0

6 months ago

2.0.0

6 months ago

0.5.3

6 months ago

0.6.0

6 months ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.4.1

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago