Check links, structure and front matter
docsbot check validates a docs set and reports each problem as a finding with its file,
line, severity and a hint. It never edits files.
Use it before a release, on every pull request, or after a migration, to catch:
- links to pages, files or
#sectionsthat do not exist, including links that only work on case-insensitive file systems (macOS, Windows) and break on Linux - external URLs that return 404, redirect permanently or time out
- missing images and images without alt text
- pages nothing links to, navigation entries that point nowhere, two files publishing to the same URL
- skipped heading levels, empty headings, more than one H1, duplicate titles
- front matter that does not parse or does not match your JSON Schema
- tags outside your controlled vocabulary
- leftover
TODO,FIXMEand placeholder markers - drafts marked ready while their claims are still unverified
Check a repository
docsbot check # the current folder
docsbot check docs # a folder
docsbot check docs/guide/install.md # one file
docsbot check https://docs.example.com # a live site
On a local repository, links resolve the way readers follow them: relative to the file,
from the site root, as pretty URLs, and as full URLs to base_url. Navigation comes from
mkdocs.yml, SUMMARY.md, Docusaurus sidebars or the folder structure.
On a live site, docsbot reads llms.txt, then the sitemaps listed in robots.txt, then
follows internal links up to --max-pages. It waits 100 ms between requests to a host,
makes at most eight at a time, honours Retry-After on 429, and caches responses on disk
for six hours.
Narrow the run
| To | Use |
|---|---|
| Skip external URLs | --offline |
| Run only some rule groups | --only links,images (groups: links, images, structure, metadata, drafts) |
| Check links and images only | docsbot links docs (the same as --only links,images) |
| Report only files a branch changed | --changed-only --base origin/main |
| Skip pages | --exclude "drafts/**" or exclude in the config |
Check #fragments on external pages too |
--external-anchors |
--changed-only still reads the whole site, so a changed page that links to an unchanged
one is checked correctly; it only filters what is reported.
Change severities and the fail level
Every rule has a default severity: error, warning or info. Change one for a run:
docsbot check --rule page-orphan=off --rule content-todo=info
Or for the project, in docsbot.yml:
check:
fail_level: warning # exit 1 on warnings too
rules:
page-orphan: off
link-not-in-nav: info
--fail-level (or check.fail_level) is the lowest severity that makes docsbot exit 1.
Set it to off to report without ever failing. The rules reference
lists every rule.
Validate front matter
Point check.schema at a JSON Schema (written in JSON or YAML) and every page’s front
matter is validated against it; failures are reported as frontmatter-schema:
check:
schema: frontmatter.schema.yaml
# frontmatter.schema.yaml
type: object
required: [title, description]
properties:
title: {type: string, minLength: 5}
description: {type: string, maxLength: 160}
tags: {type: array, items: {type: string}}
To keep tags consistent, add a vocabulary file
and set vocabulary: vocab.yaml. Tags that are aliases (k8s for Kubernetes) or not in
the list are reported.
Output formats
| Format | Use it for |
|---|---|
text (default) |
reading in a terminal |
json |
scripts and dashboards |
github |
annotations on pull request lines in GitHub Actions |
sarif |
GitHub code scanning and other SARIF viewers |
junit |
CI systems that show test reports |
docsbot check -f sarif -o docsbot.sarif
Common problems
Too many external link failures. Some sites refuse automated requests (LinkedIn,
some CDNs). Those are reported as link-external-unverified at info severity. Skip them
entirely with links.exclude_urls.
Links that a site generator rewrites. Render hooks and shortcodes sometimes use
shorthand hrefs. Skip them with links.ignore_hrefs, a list of regular expressions
matched against the raw href.
Pages reported as orphans that are meant to be entry points. List their routes in
check.entry_pages.