makestatic-verify-link

1.1.16 • Public • Published

Verify Link

Verify externals links return valid HTTP status codes

For each HTML file check that a elements with an href pointing to an absolute external URL returns a valid HTTP status code.



Install

yarn add makestatic-verify-link

API

VerifyLink

Verify external absolute links return valid HTTP status codes.

A valid status code is 200, 301 or 302. In the case of the redirect status codes the target server must send a Location header otherwise an error is thrown. Redirects are followed until maxRedirects is reached.

See Also

VerifyLink

new VerifyLink(context, options)

Create a VerifyLink plugin.

Configure this plugin for the verify phase. Requires that the http-cache and graph-resources plugins have been configured.

  • context Object the processing context.
  • options Object the plugin options.
Options
  • strict Boolean=true warn rather than error when false.
  • maxRedirects Number=2 maximum number of redirects to follow.
Throws
  • Error if no HTTP agent is configured.
  • Error if no resource graph is available.

.after

VerifyLink.prototype.after(context, options)

Verifies that external absolute links (those with a protocol) return a 200 or 3xx HTTP status code.

When strict is disabled an error is not thrown but a warning message is logged.

  • context Object the processing context.
  • options Object the plugin options.
Throws
  • Error when a link returns an invalid status code in strict mode.

License

MIT


Created by mkdoc on March 12, 2017

Package Sidebar

Install

npm i makestatic-verify-link

Weekly Downloads

0

Version

1.1.16

License

MIT

Last publish

Collaborators

  • tmpfs