Check a mdBook site for broken links
Rotproof checks every link on a website on a schedule and emails you when one breaks. This page is about using it on a site built with mdBook: what mdBook already checks for you, what it leaves out, and what to set up first.
Check your site's first 25 pages free. No account, and nothing is emailed.
What mdBook checks itself
mdBook doesn't check links by itself. The usual addition is the mdbook-linkcheck backend, which checks links between chapters and, with follow-web-links switched on, links to other websites.
What that leaves out
That checker runs when the book is built, and its report goes to whoever reads the build log. Sites that refuse automated requests show up as failures until you list them under exclude.
The larger gap is time. A build checks your links on the day you build. A page you linked to last year can be deleted, moved or sold next month, and nothing in your own repository changes when it does. Nobody finds out until a reader does.
How Rotproof reads a mdBook site
mdBook writes plain HTML files, so your links are in the HTML your server sends and Rotproof can read them, the free check included. We test Rotproof every night on a 100-page mdBook site with 993 links: a copy of the Rust Compiler Development Guide.
mdBook doesn't write a sitemap. Without one, Rotproof reads your home page only, so add a sitemap.xml listing your chapters, with a plugin or a short script, before you check the site.
The free check reads your home page and up to 24 more pages from your sitemap, and checks up to 300 links on them.
What it checks, and how
- Every link, twice. A link that fails is checked again about a minute later, and is reported only if it fails both times.
- More than missing pages. Pages that load but say "not found", domains that have been parked or put up for sale, and links to a section that no longer exists on a page.
- Blocked isn't broken. A site that refuses automated checkers is listed apart as one we couldn't check. It's never reported as broken.
- Where to fix it. Each problem lists the pages it's on, with the link text, so you know which file to edit.
From one check to a schedule
The free check is a single look at 25 pages. With a free account, Rotproof checks up to 500 pages every week and emails you when a link breaks or starts working again. Paid plans check daily.
Checking on a schedule needs proof that the site is yours. That's one DNS record, added wherever you manage your domain. If you can't add DNS records, as on a github.io or readthedocs.io address, it's a tag in your home page's <head> instead. The tag works for a site with a host name of its own, such as name.github.io. A site in a folder of one, such as name.github.io/project, can have the free check but not a schedule.
Before a change is published
If the site is built on GitHub, the build check reads each proposed change as it would be published, and lists the broken links it adds, links to other websites included, before anyone can follow them. It's free on every plan.
Other documentation tools
The same notes for Docusaurus, MkDocs, Sphinx and VitePress.