Rotproof

Check for broken links before they're published

Rotproof checks the links on your live site every day or every week, and tells you when one breaks. The build check catches the ones a change is about to add, before anyone can follow them.

It's a GitHub Action, Rotproof link check. On each pull request it reads your site as the change would build it, and lists the broken links the change brings in, with the file and line of each. It's free on every plan, the Free plan included.

What it checks

Before you start

Set it up

  1. Create a token. In Rotproof, go to Account, then API tokens. Only an owner of your organization can create one.
  2. Save it in your repository. On GitHub, open the repository's Settings, then Secrets and variables, then Actions, and add a new repository secret named ROTPROOF_TOKEN with the token as its value.
  3. Add the check after the step that builds your site:
- name: Check links
  uses: rotproof-dev/check-links@v1
  with:
    path: build
    site: https://docs.example.com
    token: ${{ secrets.ROTPROOF_TOKEN }}

path is the folder your build writes the finished site to, such as build, site, _site or book. site is the site's address as it is in Rotproof. token is the secret from step 2. Your site's page in Rotproof shows this step with its address filled in.

The next pull request runs the check. Its report is on the run's summary page.

Warn, or stop the change

The fail-on setting decides when the check fails:

Start with none, and switch to new once the reports are ones you'd act on.

Pages a change removes

When a page is renamed or deleted, everything that pointed to it breaks: links on other sites, answers on forums, search results and bookmarks. The check compares your build with the pages Rotproof found on your live site in its latest check, from the site's sitemap, which most documentation tools make. A page in the build at any address, or one your build redirects, is fine.

For each page that's gone, the check looks for one new page with the same title or the same name at the end of its address, and suggests redirecting there. It's a warning and never fails the check: your host may redirect in settings the build doesn't contain.

How to add a redirect from an old page, here docs/setup, to the page that replaced it, docs/getting-started:

When the check knows your tool, it writes these for you with the real addresses filled in: from a _redirects file in the build, Docusaurus, Hugo or Jekyll. For the others it gives the old and new addresses.

Pull requests from forks

GitHub doesn't give secrets to a pull request from a fork, so there's no token. The check then reads links to your own pages only, and its report says so.

Don't switch the workflow to pull_request_target to get round this. That runs a stranger's change with your secrets, and they can take the token.

Limits

What Rotproof receives

The addresses of the links in your built site, your token, and the site's address. Rotproof requests those addresses as RotproofBot, one request a second to each website, and keeps the results for 7 days. In return, it sends the check the addresses and titles of your live site's pages, which are compared with your build on GitHub's machine. See the privacy policy.

The check's code is public: rotproof-dev/check-links.