makestatic-verify-link v1.1.16
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-linkAPI
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.
contextObject the processing context.optionsObject the plugin options.
Options
strictBoolean=true warn rather than error whenfalse.maxRedirectsNumber=2 maximum number of redirects to follow.
Throws
Errorif no HTTP agent is configured.Errorif 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.
contextObject the processing context.optionsObject the plugin options.
Throws
Errorwhen a link returns an invalid status code instrictmode.
License
MIT
Created by mkdoc on March 12, 2017