postdoc check
Checks the project in seconds, without a browser or a build: the configuration, every
page, and every link between the pages. Run it after each change, and postdoc test
before you publish.
It finds:
- settings and template variables of 0.3.0-preview4 that PostDoc still reads, such as
directories.contentor_import(): they're listed as warnings, which don't fail the check - an output directory that holds the project's own files, which a build would delete
- pages that can't be compiled: a missing layout, front matter or a storymap that isn't valid, or an error in a layout
- links to pages that don't exist, and to ids that their page doesn't have
- pictures that aren't files of the site
Links to paths that another site serves on the same domain, such as an older version
of the docs, can be left out with check.ignoreLinks in the configuration.
Drafts are checked too.
Options:
--json [file]- prints the problems as JSON instead, or writes them to the file: each with its kind, the page it's on and what's wrong. The warnings are in a list of their own,warnings.
The command exits with 1 when it finds a problem, so it can stop a CI job, or tell an AI agent that its change isn't done.
Example
sh
npx postdoc check --json