Skip to content

Check a built site

recit-site check reads the site that recit-site build wrote and reports what its pages point to and do not have. It runs on the build, not on the sources: what it sees is what a visitor gets.

TerminalBash
recit-site build recit-site check

What it checks

  • Links: every href, src, srcset and poster of every built page (a page, a stylesheet, an image, a data file such as a CSV or a JSON) must land on a file of the build. /guide finds guide, guide/index.html or guide.html, as the host serves them.

  • Anchors: the #fragment of a link must name an id (or a name) of the page it lands on. #top always counts. The fragment of a link to a file that is not a page (file.pdf#page=2) is not checked.

  • Accessibility, with --a11y: axe runs on every built page, served on a local port in Chromium, and each violation (its rule, impact and elements) enters the report.

External addresses (https://…, mailto:) are never fetched. A root address outside the site's basePath belongs to another site of the same host and is skipped. Addresses in scripts, styles and comments are not read.

Options

OptionWhat it doesDefault
--out <folder>The build folder to readdist/, else .vercel/output/static
--base-path <path>The site's basePath: the pages are read under dist/<basePath>/ and root addresses lose it (/docs)the basePath of recit.config
--no-linksSkip the link check—
--no-anchorsSkip the anchor check—
--a11yRun axe on every page (Playwright and axe-core installed in the site)—
--jsonPrint the report as JSON on stdout—

The command exits with code 1 when it finds a problem, so a continuous integration step fails on a broken link:

TerminalBash
recit-site build && recit-site check --json > site-check.json

The JSON report lists the number of pages read and each problem with its kind (link or anchor), the page that holds it and the address as the page writes it:

JSONJSON
{ "pages": 42, "problems": [{ "kind": "anchor", "page": "guide/index.html", "href": "/reference#limits" }] }

With --a11y, the report gains accessibility, one entry per violation:

JSONJSON
{ "accessibility": [ { "page": "guide/index.html", "rule": "button-name", "impact": "critical", "targets": ["#menu"], "help": "Buttons must have discernible text" } ] }

Accessibility with axe

Récit's site framework does not ship a browser. --a11y uses the Playwright and the axe-core of the site, as the PDF export does:

TerminalBash
pnpm add -D playwright axe-core pnpm exec playwright install chromium recit-site build && recit-site check --a11y

Without them, the command stops and names what to install.

In continuous integration

A GitHub Actions workflow that fails on a broken link or an axe violation:

YAMLYAML
name: Site check on: [push, pull_request] jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm exec playwright install --with-deps chromium - run: pnpm exec recit-site build - run: pnpm exec recit-site check --a11y --json > site-check.json - if: always() uses: actions/upload-artifact@v4 with: name: site-check path: site-check.json