This module is released via npm, install the latest released version with:
npm install --save metalsmith-linkcheck
If using the CLI for Metalsmith, metalsmith-linkcheck can be used like any other plugin by including it in
var linkcheck = ;__dirname;
Because metalsmith-linkcheck will only check HTML pages, normally you will want to use metalsmith-linkcheck at the end of your build pipeline when all of your HTML pages have been generated. Note that metalsmith-linkcheck requires network access (duh). In addition, relative and root-relative local links are checked by looking for them in the metalsmith files array, and so this may not work if you using local links to things not included in your Metalsmith build.
metalsmith-linkcheck will ignore links that have or are descendants of
elements with the class
link_exception. For example, both of these links
will not be checked:
This link will be skipped.So will thisone.
metalsmith-linkcheck does not require any options, but the following options are available:
timeout (s) (optional)
(default: 15 s)
Timeout after which a link will be marked as down. 15 s by default.
(default : true)
If set, metalsmith-linkcheck will fail if no network connection is available. Otherwise, it will still check internal links before exiting. Note in this case that external links will not be reported as failing.
If set the metalsmith build process will halt if links are missing.
If set metalsmith-linkcheck will record when external links succeed in
checkFile and not repeat the check for an interval set by
(default : 1440 (24 hours))
Determines the length between successive link checks when
set to true.
Path relative to the metalsmith source directory where metalsmith-linkcheck caches link check information. This will be removed from the build directory.
Path relative to the metalsmith source directory to a JSON file containing an array of links to ignore. This will be removed from the build directory.
Path relative to the metalsmith source directory to a JSON file where link failures are recorded. This will be removed from the build directory.