CASOON Open Source
Audit what you actually ship.
astro-post-audit runs after every astro build and checks the finished dist/ output: SEO signals, broken internal links and lightweight WCAG heuristics. Static analysis in a Rust binary, no browser, no network calls unless you enable external link checks.
npm i -D @casoon/astro-post-auditpnpm add -D @casoon/astro-post-audityarn add -D @casoon/astro-post-audit- checks per run, listed by progress: verbose
- 32
- presets, from relaxed to production
- 8
- report formats: JSON, Markdown, SARIF, HTML
- 4
- platforms with prebuilt binaries
- 5
What it does
Checks the output, not the source
Canonicals, sitemap, robots.txt, hreflang, Open Graph and JSON-LD are read from the generated files, so the audit sees what search engines and visitors get.
Shared accessibility rules
Accessibility and document rules come from the shared a11y-rules crates, the same ones behind auditmysite and LiveAudit, so a finding has one id everywhere. Contrast is reported as not testable instead of passed.
Remedies in Astro terms
Each finding names the rule, the element and a fix that points to BaseHead, astro:assets, Astro.site or your Content Collections.
Rolls out gradually
Presets, per-rule severity, a baseline that reports only new findings, and a go-live gate that catches staging domains and noindex before production.
Captured from the test fixtures
All examples →✖ astro-post-audit Errors: 1 Warnings: 3 Info: 3 Files: 4 ● long-title.html (7) - The document has no main landmark. [landmarks/main-missing] Remedy: Landmarks structure the page for everyone who cannot see it. - The document has no navigation landmark. [landmarks/navigation-missing] (medium confidence) Remedy: Landmarks structure the page for everyone who cannot see it. - The document has no banner landmark. [landmarks/banner-missing] (medium confidence) Remedy: Landmarks structure the page for everyone who cannot see it. - The document has no contentinfo landmark. [landmarks/contentinfo-missing] (medium confidence) Remedy: Landmarks structure the page for everyone who cannot see it. - Content is not contained in any landmark. [landmarks/content-outside] Remedy: All content belongs inside a landmark. - Title is 143 chars (recommended max: 60) [html/title-too-long] at `title` Remedy: Shorten the title for better display in search results - Meta description is 242 chars (recommended max: 160) [html/meta-description-too-long] at `meta[name='description']` Remedy: Shorten the description for better display in search results
A baseline recorded for a clean site, then one page added: the report lists only the new page. Every output on this site is a real run of the audit binary against the fixtures in tests/fixtures, captured with examples/capture.sh.
examples/baseline.ansiQuickstart
Install, register the integration, build.
- Install
@casoon/astro-post-auditas a dev dependency. - Add
postAudit()to the integrations inastro.config.mjs, aftersitemap(). - Run
astro build. The report follows the build;failOndecides whether findings fail it.
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import postAudit from '@casoon/astro-post-audit';
export default defineConfig({
site: 'https://example.com',
integrations: [
sitemap(),
// after sitemap(): the audit checks the generated sitemap
postAudit({ preset: 'standard', failOn: 'errors' }),
],
});New in v0.10.0
Changelog →- Performance:
html-conform0.3.4 (relax-ng 0.2.3, schematron-engine 0.2.1, xpath-eval 0.2.3) cutshtml_validationfrom about 0.5 s to roughly 15–20 ms CPU per page when the cache is cold; findings are unchanged (#109, #113). - Site: the footer follows the page language instead of always showing German text, and the start page now carries a release teaser and an FAQ (theme 0.11.1).
- Accessibility: rules come from
a11y-rules0.26. Several heuristic rules now reportreviewinstead offail, landmark and heading-structure rules count as best practice, and new link rules (links/new-window-unannounced,links/purpose-link-only, URL and single-character link names) are added. - Accessibility: findings that only concern WCAG AAA criteria are reported once per element pattern across the site instead of once per page; the message gives the number of occurrences and pages.
- AI visibility and UX: heuristic findings carry the outcome
reviewinstead offail:ai-visibility/low-word-count,no-semantic-sections,no-subheadings,missing-author-schema,ux/no-cta,ux/no-trust-signals,ux/high-link-densityandux/high-interactive-density. Severity and build gating are unchanged. Messages say what was found, not what AI systems or users supposedly prefer (#103). - Documentation: the README states the cold-cache cost of
rules.html_validationand recommends persistingnode_modules/.cache/astro-post-audit/in CI (#109).
Frequently asked questions
Does astro-post-audit make network calls during the build?
No, by default. It's static analysis against the generated dist/ output, with no browser involved. The only opt-in exception is external link checking, which sends HEAD requests to verify third-party URLs.
Will it slow down my build on a large site?
Most checks run in well under a second on typical sites. The one expensive check, full HTML5 conformance validation, caches its results per page by content hash, so an incremental build only re-validates pages that actually changed.
Can I adopt it on a site that already has findings, without failing CI right away?
Yes. Run with writeBaseline: true once to snapshot current findings, then point baseline at that file — only new findings are reported from then on. Delete entries from the baseline to re-enable specific checks.
Where do the accessibility rule ids come from?
From a11y-rules, the shared core crate also used by auditmysite and LiveAudit, so a finding like images/alt-missing carries the same id everywhere. Older ids from before that migration still work in severity overrides and baselines.
Does it replace a browser-based tool like Lighthouse?
No. It never runs a browser, so it can't measure things like computed contrast or runtime performance — those show up in the report as capability_missing rather than silently passing. It covers SEO, links and static WCAG heuristics against what actually shipped.