Package: fastlinkcheck
fastlinkcheckCheck for broken external and internal links.fastlinkcheckchecks for broken links in HTML documents.  This occurs in parallel so performance is fast.  Both external links and internal links are checked.  Internal links are checked by verifying local files.To get started, readthe documentation.Installpip install fastlinkcheckUsageAfter installingfastlinkcheck, the cli commandlink_checkis available from the command line.  We can see various options with the--helpflag.link_check--helpusage: link_check [-h] [--host HOST] [--config_file CONFIG_FILE] [--pdb]
                  [--xtra XTRA]
                  path

Check for broken links recursively in `path`.

positional arguments:
  path                  Root directory searched recursively for HTML files

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           Host and path (without protocol) of web server
  --config_file CONFIG_FILE
                        Location of file with urls to ignore
  --pdb                 Run in pdb debugger (default: False)
  --xtra XTRA           Parse for additional args (default: '')We can search the directory_example/broken_linksin this repo recursively for broken links like this:link_check_example/broken_linksERROR: The Following Broken Links or Paths were found:

- 'http://fastlinkcheck.com/test.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`

- 'http://somecdn.com/doesntexist.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`

- Path('/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.js') was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`Specifying the--hostparameter allows you detect links that are internal by identifying links with that host name. External links are verified by making a request to the appropriate website.  On the other hand, internal links are verified by inspecting the presence and content of local files.We must be careful when using the--hostargument to only pass the host (and path, if necessary)withoutthe protocol.  For example, this is how we specify the hostname if your site's url ishttp://fastlinkcheck.com/test.html:link_check_example/broken_links--hostfastlinkcheck.comERROR: The Following Broken Links or Paths were found:

- 'http://somecdn.com/doesntexist.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`

- Path('/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.js') was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`We now have one less broken link as there is indeed a file namedtest.htmlin the root of the path we are searching.  However, if we add a path to the end of--host, such asfastlinkcheck.com/mysitethe link would again be listed as broken because_example/broken_links/mysite/test.htmldoes not exist:link_check_example/broken_links--hostfastlinkcheck.com/mysiteERROR: The Following Broken Links or Paths were found:

- 'http://fastlinkcheck.com/test.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`

- 'http://somecdn.com/doesntexist.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`

- Path('/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.js') was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`You can ignore links by creating a text file that contains a list of urls and paths to ignore.  For example, the file_example/broken_links/linkcheck.rccontains:cat_example/broken_links/linkcheck.rctest.js
https://www.google.comWe can use this file to ignore urls and paths with the--config_fileargument.  This will filter out references to the broken link/test.jsfrom our earlier results:link_check_example/broken_links--hostfastlinkcheck.com--config_file_example/broken_links/linkcheck.rcERROR: The Following Broken Links or Paths were found:

- 'http://somecdn.com/doesntexist.html' was found in the following pages:
  - `/Users/hamelsmu/github/fastlinkcheck/_example/broken_links/test.html`Finally, if there are no broken links,link_checkwill not return anything.  The directory_example/no_broken_links/does not contain any HTML files with broken links:link_check_example/no_broken_linksNo broken links found!PythonYou can also use these utilities from python instead of the terminal.  Please seethese docsfor more information.Usinglink_checkin GitHub ActionsHere is an example of how you can use this utility in GitHub Actions:name:Check Linkson:[workflow_dispatch,push]jobs:check-links:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v2-uses:actions/setup-python@v2-name:check for broken linksrun:|pip install fastlinkchecklink_check _exampleWe can a few more lines of code to open an issue instead when a broken link is found, using thegh cli:...-name:check for broken linksrun:|pip install fastlinkchecklink_check _example 2> err || trueexport GITHUB_TOKEN="YOUR_TOKEN"[[ -s err ]] &&  gh issue create -t "Broken links found" -b "$(< err)" -R "yourusername/yourrepo"We can extend this even further to only open an issue when another issue with a specific label isn't already open:...-name:check for broken linksrun:|pip install fastlinkchecklink_check "docs/_site" --host "docs.fast.ai" 2> err || trueexport GITHUB_TOKEN="YOUR_TOKEN"if [[ -z $(gh issue list -l "broken-link")) && (-s err) ]]; thengh issue create -t "Broken links found" -b "$(< err)" -l "broken-link" -R "yourusername/yourrepo"fiSee theGitHub Actions docsfor more information.