Astro Integration
Astro Legal
Generate comprehensive, production-ready legal policy pages for Astro from a single configuration file at build time.
Last Updated: 01 April 2026
Usage Snapshot
59
Downloads in Last 30 Days
v2.0.0
Latest npm Version
Source: npm registry
Why This Plugin Exists
Legal policy pages are essential for compliance, trust, and platform requirements, but they are often inconsistent, outdated, or manually maintained.
Astro Legal solves this by generating deterministic, structured legal documents directly from a single configuration file during the build process.
All policies are rendered as native Astro pages, fully owned by the user, and integrated into the site’s existing layout and routing.
Design Principles
- Build-time only — zero runtime or client-side logic
- User-owned output — files are never overwritten
- Required layout enforcement for consistency
- No analytics, telemetry, or tracking
- Deterministic and CI/CD-safe
What This Plugin Delivers
- Generates multiple legal policies from a single config file
- Scaffolds Astro pages under a configurable base path
- Injects organisation and contact metadata consistently
- Fails closed when configuration is invalid
- Runs automatically during astro dev and astro build
Installation
npm install astro-legal
Configuration, policy selection, and layout setup are handled via the legal.config.json file.
FAQs
What does the Astro Legal plugin do?
Astro Legal generates complete, production-ready legal policy pages such as Privacy Policy, Terms of Service, and compliance documents at build time using a single configuration file.
Does Astro Legal require a layout?
Yes. Astro Legal enforces a required user-provided Astro layout to ensure all generated policies are rendered consistently within the site’s design.
Implementation FAQs
What does the Astro Legal plugin do?
Astro Legal generates complete, production-ready legal policy pages for Astro sites at build time using a single configuration file.
What types of policies can Astro Legal generate?
Astro Legal supports privacy policies, terms of service, acceptable use policies, compliance disclosures, security policies, and other common legal and trust documents.
How is configuration handled?
All configuration is defined in a single legal.config.json file, which controls enabled policies, output paths, organisation metadata, contact details, and the required layout.
Can I enable only certain policies?
Yes. Policies are enabled individually in the configuration file. Disabled policies are never generated.
Why does Astro Legal require a layout?
Legal pages must integrate seamlessly with a site’s design and metadata. Astro Legal enforces a required layout to guarantee consistent rendering and ownership.
How is the layout path validated?
The layout path is validated at configuration load time. Invalid or missing layouts prevent policy generation by design.
Project Links
Source code, package distribution, releases, and documentation.
Need Implementation Details?
Read the FAQs for usage patterns, integration caveats, and rollout guidance.